post your comment   print   send to a friend
Rate:   0% | Views: 357
Question categories:  Java

Why does my LiveConnect sockets Applet sometimes hang?

When Javascript calls a method in a Java Applet, it is running in a special context. Therefore, it must not block, (that is, 'enter' a wait state) while the system handles /O a/, or other Java thread runs. In many cases, the call may block, such as reading from a Socket (or nearly any method in the IO & net packages). Other cases are more obscure.

Possible blocking calls may include: getImage(), play(), showDocument(), INetAddress.getAddress(). Simply generating the first instance of a class can block because it may need to be loaded from the host or file system cache, e.g. new myPublicClass().

Generally, it is best to design LiveConnected Applet methods to:

1.

Return ready results

2.

Queue request for a worker thread to handle

This is not difficult, and it allows your Javascript to continue to react to the user while the Applet does its work.

NOTE: It would be inefficient for simple calls if this was handled automatically. Thus, every LiveConnect call requires thread rescheduling.

Customer Feedback
Rate:   0% | Views: 357 | Please Rate:  
 
If you have other comments or ideas for future technical tips, please type them here:

Email: (optional)

Comments: (optional)

 Custom Design | Best Web Hosting    Back to serch results
Browse the Base
Knowledge Base
Web Design
  Do It Yourself
    Java
Messages
 

$75 Free Google AdWords

Free $75 Google AdWords when you sign up for WebImage! Target by location, create your own, or let Google create your ads for you. Check out http://www.aplus.net/google.html to see how AdWords works for you.

Private Area
 
Ask
in Private
   
Personal
Folder
 
Related Questions
 
1. How do I access Servlets or CGI programs from Java?
 
2. My applet computes its window size. Can I resize it in the browser?
 
3. How do I communicate between my applets in the same browser?
 
4. How do I force the browser to reload my Java classes without exiting Navigator?
 
5. Why does my java console show an applet is pruned?
 
Home Browse Search Ask in Private Personal Folder   Help
powered by web hosting 
  Logged as: Guest