|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--info.jedi.net.ResourceHandler
Class ResourceHandler keeps track of allocating resources properly for the jedi.net infrastructure. It provides methods to supply datagram packets, packet handling threads, and sockets. It adds efficiency to JEDI by caching each of these items so they don't have to be created for each incoming JEDI call.
MailDaemon
Field Summary | |
static int |
MAX_LENGTH
The maximum length of a UDP packet. |
Method Summary | |
java.net.DatagramPacket |
getPacket()
Returns a DatagramPacket suitable for receiving any size of UDP packet up to the maximum size (65535 bytes). |
java.net.DatagramSocket |
getSocket()
Returns a socket from this ResourceHandler's cache, or creates a new one if the cache is empty. |
void |
returnPacket(java.net.DatagramPacket packet)
Returns a datagram packet to the cache. |
void |
returnSocket(java.net.DatagramSocket socket)
Returns a socket allocated with getSocket() to this ResourceHandler's socket cache, so it can be reused by the next getSocket() call. |
void |
threadBusy()
Warns the ResourceHandler that the current thread will be busy handling some request and thus unable to handle additional requests for a while. |
void |
threadIdle()
Tells the ResourceHandler that a thread (which called threadBusy() previously) is now once more available to take incoming packets |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int MAX_LENGTH
Method Detail |
public java.net.DatagramPacket getPacket()
public void returnPacket(java.net.DatagramPacket packet)
public void threadBusy()
public void threadIdle()
public java.net.DatagramSocket getSocket() throws java.net.SocketException
public void returnSocket(java.net.DatagramSocket socket)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |