Package org.jppf.client
Class AbstractClassServerDelegate
java.lang.Object
org.jppf.client.AbstractClientConnectionHandler
org.jppf.client.AbstractClassServerDelegate
- All Implemented Interfaces:
AutoCloseable,Runnable,Thread.UncaughtExceptionHandler,ClassServerDelegate
public abstract class AbstractClassServerDelegate
extends AbstractClientConnectionHandler
implements ClassServerDelegate, Thread.UncaughtExceptionHandler
Abstract implementation of the client end of the JPPF distributed class loader.
- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringUnique identifier for this class server delegate, obtained from the local JPPF client.protected final StringReadable name for this delegate.protected booleanDetermines if the handshake with the server has been performed.protected final org.jppf.classloader.ResourceProviderReads resource files from the classpath.protected booleanIndicates whether this socket handler should be terminated and stop processing. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault instantiation of this class is not permitted. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the socket connection.getName()Get the name of this delegate.org.jppf.comm.socket.SocketWrapperGet the socket client uses to communicate over a socket connection.protected voidPerform the handshake with the server.voidinit()Initialize the connection.voidInitialize this delegate's resources.booleanisClosed()Determine whether this connection handler is closed.protected voidProcess the next class laodign request from the server.protected org.jppf.classloader.JPPFResourceWrapperRead a resource wrapper object from the socket connection.voidSet the name of this delegate.voiduncaughtException(Thread t, Throwable e) protected voidwriteResource(org.jppf.classloader.JPPFResourceWrapper resource) Write a resource wrapper object to the socket connection.Methods inherited from class org.jppf.client.AbstractClientConnectionHandler
createSSLConnection, getSocketClient, getSocketInitializer, isClosed
-
Field Details
-
stop
protected boolean stopIndicates whether this socket handler should be terminated and stop processing. -
resourceProvider
protected final org.jppf.classloader.ResourceProvider resourceProviderReads resource files from the classpath. -
clientUuid
Unique identifier for this class server delegate, obtained from the local JPPF client. -
handshakeDone
protected boolean handshakeDoneDetermines if the handshake with the server has been performed. -
formattedName
Readable name for this delegate.
-
-
Constructor Details
-
AbstractClassServerDelegate
Default instantiation of this class is not permitted.- Parameters:
owner- the client connection which owns this connection delegate.
-
-
Method Details
-
getName
Get the name of this delegate.- Specified by:
getNamein interfaceClassServerDelegate- Returns:
- the name as a string.
-
setName
Set the name of this delegate.- Specified by:
setNamein interfaceClassServerDelegate- Parameters:
name- the name as a string.
-
initSocketClient
Initialize this delegate's resources.- Throws:
Exception- if an error is raised during initialization.
-
readResource
Read a resource wrapper object from the socket connection.- Returns:
- a
JPPFResourceWrapperinstance. - Throws:
Exception- if any error is raised.
-
writeResource
Write a resource wrapper object to the socket connection.- Parameters:
resource- aJPPFResourceWrapperinstance.- Throws:
Exception- if any error is raised.
-
handshake
Perform the handshake with the server.- Throws:
Exception- if any error occurs.
-
processNextRequest
Process the next class laodign request from the server.- Throws:
Exception- if any error occcurs.
-
close
public void close()Close the socket connection.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classAbstractClientConnectionHandler
-
uncaughtException
- Specified by:
uncaughtExceptionin interfaceThread.UncaughtExceptionHandler
-
init
Initialize the connection.- Throws:
Exception- if an error is raised while initializing the connection.
-
getSocketClient
Get the socket client uses to communicate over a socket connection.- Returns:
- a
SocketWrapperinstance. - Throws:
Exception- if the connection has failed or timed out.
-
isClosed
boolean isClosed()Determine whether this connection handler is closed.- Returns:
trueif this connection handler is closed,falseotherwise.
-