|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--loader.WorkerClassServer
class which handles communication with NetworkClassLoader.
It waits for a class request (the name is a String).
The requested class is searched first in the cache (a byte array cache), and then
in CLASSPATH of the server machine.
If the class is found it is loaded as a byte array.
To the client - NetworkClassLoader - a ClassPacket is sent with the byte array.
If the class is not found a ClassPacket with an error.
Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
Constructor Summary | |
WorkerClassServer(java.net.Socket clientSocket,
java.util.Hashtable classesCache)
Constructor. |
Method Summary | |
protected byte[] |
getClassBytes(java.lang.String className)
get the bytes for the requested class |
protected byte[] |
getResourceBytes(java.lang.String resourceName)
get the bytes for the requested resource |
protected byte[] |
loadResource(java.io.InputStream is)
read a file from a stream and returns a byte array. |
void |
run()
A loop waiting for a class name. |
protected void |
sendPacket(byte[] bytes)
send a byte array packet to the client |
protected void |
sendPacket(java.lang.String error)
send an error packet to the client |
protected void |
writePacket(ResourcePacket packet)
write a packet to the socket |
Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public WorkerClassServer(java.net.Socket clientSocket, java.util.Hashtable classesCache) throws java.io.IOException
clientSocket
- socket for the connection with the client.classCahce
- the cache of classes.Method Detail |
public void run()
protected byte[] getResourceBytes(java.lang.String resourceName) throws java.io.IOException
resourceName
- the name of the resourceprotected byte[] getClassBytes(java.lang.String className) throws java.io.IOException
className
- the name of the classprotected byte[] loadResource(java.io.InputStream is) throws java.io.IOException
is
- the InputStream to read fromprotected void sendPacket(java.lang.String error) throws java.io.IOException
protected void sendPacket(byte[] bytes) throws java.io.IOException
protected void writePacket(ResourcePacket packet) throws java.io.IOException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |