Package org.jppf.classloader
Class JPPFResourceWrapper
java.lang.Object
org.jppf.classloader.JPPFResourceWrapper
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CompositeResourceWrapper
Instances of this class encapsulate the necessary information used by the network classloader,
for sending class definition requests as well as receiving the class definitions.
- Author:
- Laurent Cohen, Martin JANDA
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of the possible states for this resource wrapper. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JPPFResourceWrapper[]Constant for an emptyJPPFResourceWrapperarray.protected JPPFResourceWrapper[]Performance optimization. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a uuid to the uuid path of this resource wrapper.booleanbyte[]Get the serialized callback to execute code on the client side.longGet the ID of an eventual remote-computed callable.Get the metadata corresponding to the specified key.getData(ResourceIdentifier key, Object def) Get the metadata corresponding to the specified key.byte[]Get the actual definition of the requested class.protected ObjectGet the monitor used for synchronized access to data.getName()Get the name of the class whose definition is requested.Get the uuid sent by a node when it first contacts a resource provider.longGet the uuid for the original task bundle that triggered this resource request.longgetResourceId(String uuid) Get the array of requests held by this request.getState()Get the state associated with this resource wrapper.Get a reference to the traversal list that Keeps and manages the uuid path list and the current position in it.booleanhasAny(ResourceIdentifier... ids) Determine whether this resource has any of the specified data.inthashCode()booleanDetermine whether the class should be loaded through the network classloader.booleanbooleanDetermine whether this is a request for a single resource definition.voidsetCallable(byte[] callable) Set the serialized callback to execute code on the client side.voidsetData(ResourceIdentifier key, Object value) Get the metadata corresponding to the specified key.voidsetDefinition(byte[] definition) Set the actual definition of the requested class.voidsetDynamic(boolean dynamic) Set whether the class should be loaded through the network classloader.voidsetHandshaking(boolean handshaking) voidSet the name of the class whose definition is requested.voidsetProviderUuid(String providerUuid) Set the uuid sent by a node when it first contacts a resource provider.voidsetRequestStartTime(long requestStartTime) voidsetRequestUuid(String requestUuid) Set the uuid for the original task bundle that triggered this resource request.voidsetResourceId(String uuid, long resourceId) Set the unique identifier for this resource request in the specified driver.voidsetResourceIds(Map<String, Long> resourceIds) voidSet the state associated with this resource wrapper.voidsetUuidPath(TraversalList<String> uuidPath) Set the reference to the traversal list that Keeps and manages the uuid path list and the current position in it.toString()
-
Field Details
-
EMPTY_RESOURCE_WRAPPER_ARRAY
Constant for an emptyJPPFResourceWrapperarray. -
resources
Performance optimization.
-
-
Constructor Details
-
JPPFResourceWrapper
public JPPFResourceWrapper()Default constructor.
-
-
Method Details
-
addUuid
Add a uuid to the uuid path of this resource wrapper.- Parameters:
uuid- the identifier as a string.
-
getName
Get the name of the class whose definition is requested.- Returns:
- the class name as a string.
-
setName
Set the name of the class whose definition is requested.- Parameters:
name- the class name as a string.
-
getDefinition
public byte[] getDefinition()Get the actual definition of the requested class.- Returns:
- the class definition as an array of bytes.
-
setDefinition
public void setDefinition(byte[] definition) Set the actual definition of the requested class.- Parameters:
definition- the class definition as an array of bytes.
-
isDynamic
public boolean isDynamic()Determine whether the class should be loaded through the network classloader.- Returns:
- true if the class should be loaded via the network classloader, false otherwise.
-
setDynamic
public void setDynamic(boolean dynamic) Set whether the class should be loaded through the network classloader.- Parameters:
dynamic- true if the class should be loaded via the network classloader, false otherwise.
-
getState
Get the state associated with this resource wrapper.- Returns:
- a
Statetypesafe enumerated value.
-
setState
Set the state associated with this resource wrapper.- Parameters:
state- aStatetypesafe enumerated value.
-
getUuidPath
Get a reference to the traversal list that Keeps and manages the uuid path list and the current position in it.- Returns:
- a traversal list of string elements.
-
setUuidPath
Set the reference to the traversal list that Keeps and manages the uuid path list and the current position in it.- Parameters:
uuidPath- a traversal list of string elements.
-
getProviderUuid
Get the uuid sent by a node when it first contacts a resource provider.- Returns:
- the uuid as a string.
-
setProviderUuid
Set the uuid sent by a node when it first contacts a resource provider.- Parameters:
providerUuid- the uuid as a string.
-
getRequestUuid
Get the uuid for the original task bundle that triggered this resource request.- Returns:
- the uuid as a string.
-
setRequestUuid
Set the uuid for the original task bundle that triggered this resource request.- Parameters:
requestUuid- the uuid as a string.
-
getCallable
public byte[] getCallable()Get the serialized callback to execute code on the client side.- Returns:
- a
byte[]instance.
-
setCallable
public void setCallable(byte[] callable) Set the serialized callback to execute code on the client side.- Parameters:
callable- abyte[]instance.
-
getCallableID
public long getCallableID()Get the ID of an eventual remote-computed callable.- Returns:
- the id as a long.
-
getData
Get the metadata corresponding to the specified key.- Parameters:
key- the string identifying the metadata.- Returns:
- an object value or null if the metadata could not be found.
-
getData
Get the metadata corresponding to the specified key.- Parameters:
key- the string identifying the metadata.def- a default value to return if the key is not found.- Returns:
- an object value or the specified default if the metadata could not be found.
-
setData
Get the metadata corresponding to the specified key.- Parameters:
key- the string identifying the metadata.value- the value of the metadata.
-
getResources
Get the array of requests held by this request. For simple request returns arrays containingthis.- Returns:
- a array of
JPPFResourceWrapperinstances.
-
getMonitor
Get the monitor used for synchronized access to data.- Returns:
- a
Objectinstance.
-
toString
-
equals
-
hashCode
public int hashCode() -
hasAny
Determine whether this resource has any of the specified data.- Parameters:
ids- the ids of the data to check.- Returns:
trueif this resource has any of the specified data,falseotherwise.
-
isSingleResource
public boolean isSingleResource()Determine whether this is a request for a single resource definition.- Returns:
trueif this is a request for a single resource definition,falseotherwise.
-
getResourceId
- Parameters:
uuid- the uuid of the driver for which to get a resource id.- Returns:
- the unique identifier this resource request in the server.
-
setResourceId
Set the unique identifier for this resource request in the specified driver.- Parameters:
uuid- the uuid of the driver for which to set a resource id.resourceId- the identifier as along.
-
getResourceIds
- Returns:
- the map of driver uuids to resource id.
-
setResourceIds
- Parameters:
resourceIds- the map of driver uuids to resource id.
-
getRequestStartTime
public long getRequestStartTime()- Returns:
- the time at which the request is received by the server.
-
setRequestStartTime
public void setRequestStartTime(long requestStartTime) - Parameters:
requestStartTime- the time at which the request is received by the server.
-
isHandshaking
public boolean isHandshaking()- Returns:
- whether this is a handshake request.
-
setHandshaking
public void setHandshaking(boolean handshaking) - Parameters:
handshaking- whether this is a handshake request.
-