com.hdcookbook.grin.util
Class NetworkManager
java.lang.Object
com.hdcookbook.grin.util.NetworkManager
public class NetworkManager
- extends java.lang.Object
This class runs a thread that is used for communicating with a server
via a socket. It accepts requests for network activity on the enqueue()
method, which queues the request for execution on the networking thread.
It then performs the request on the networking thread. If used with
GRIN, it is expected that the response data will be packaged as a
GRIN command, for later execution back in the animation thread.
Method Summary |
static void |
enqueue(java.lang.Runnable r)
Queue the runnable to run in the networking thread. |
static void |
shutdown()
|
static void |
start()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NetworkManager
public NetworkManager()
start
public static void start()
shutdown
public static void shutdown()
enqueue
public static void enqueue(java.lang.Runnable r)
- Queue the runnable to run in the networking thread. When the
Runnable executes, it should regulary check Thread.isInterrupted,
and return if it finds the thread has been interrupted.
- See Also:
Thread.isInterrupted()