Package org.jppf.server.node
Class AbstractNodeIO<N extends AbstractCommonNode>
java.lang.Object
org.jppf.server.node.AbstractNodeIO<N>
- Type Parameters:
N- the type of node.
- All Implemented Interfaces:
NodeIO
This class performs the I/O operations requested by the JPPFNode, for reading the task bundles and sending the results back.
- Author:
- Laurent Cohen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object[]Perform the deserialization of the objects received through the socket connection.protected abstract Object[]deserializeObjects(org.jppf.node.protocol.TaskBundle bundle) Perform the deserialization of the objects received through the socket connection.protected voidfinalizeBundleData(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) Compute the task bundle's data before it is sent back to the server.protected abstract voidPerforms the actions required if reloading the classes is necessary.protected voidinitializeBundleData(org.jppf.node.protocol.TaskBundle bundle) Prepare the task bundle's data that will be sent back to the server.protected voidpostSendResults(org.jppf.node.protocol.TaskBundle bundle) Perform some cleanup after sending the results.org.jppf.node.protocol.BundleWithTasksreadJob()Read a job from the socket connection, along with its header information.protected Object[]Deserialize the objects read from the socket, and reload the appropriate classes if any class change is detected.
A class change is triggered when anInvalidClassExceptionis caught.protected abstract voidsendResults(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) Write the execution results to the socket stream.voidwriteResults(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) Write the execution results to the socket stream.
-
Field Details
-
node
The node who owns this TaskIO.
-
-
Constructor Details
-
AbstractNodeIO
Initialize this TaskIO with the specified node.- Parameters:
node- - the node who owns this TaskIO.
-
-
Method Details
-
readJob
Description copied from interface:NodeIORead a job from the socket connection, along with its header information. -
writeResults
public void writeResults(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) throws Exception Description copied from interface:NodeIOWrite the execution results to the socket stream.- Specified by:
writeResultsin interfaceNodeIO- Parameters:
bundle- the task wrapper to send along.tasks- the list of tasks with their result field updated.- Throws:
Exception- if an error occurs while writing to the socket stream.
-
handleReload
Performs the actions required if reloading the classes is necessary.- Throws:
Exception- if any error occurs.
-
deserializeObjects
Perform the deserialization of the objects received through the socket connection.- Returns:
- an array of objects deserialized from the socket stream.
- Throws:
Exception- if an error occurs while deserializing.
-
deserializeObjects
protected abstract Object[] deserializeObjects(org.jppf.node.protocol.TaskBundle bundle) throws Exception Perform the deserialization of the objects received through the socket connection.- Parameters:
bundle- the message header that contains information about the tasks and data provider.- Returns:
- an array of objects deserialized from the socket stream.
- Throws:
Exception- if an error occurs while deserializing.
-
sendResults
protected abstract void sendResults(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) throws Exception Write the execution results to the socket stream.- Parameters:
bundle- the task wrapper to send along.tasks- the list of tasks with their result field updated.- Throws:
Exception- if an error occurs while writing to the socket stream.- Since:
- 4.2
-
readObjects
Deserialize the objects read from the socket, and reload the appropriate classes if any class change is detected.
A class change is triggered when anInvalidClassExceptionis caught. Upon catching this exception, the class loader is reinitialized and the class are reloaded.- Returns:
- an array of objects deserialized from the socket stream.
- Throws:
Exception- if the classes could not be reloaded or an error occurred during deserialization.
-
postSendResults
Perform some cleanup after sending the results.- Parameters:
bundle- the task wrapper that was sent.- Throws:
Exception- if an error occurs while writing to the socket stream.- Since:
- 4.2
-
initializeBundleData
protected void initializeBundleData(org.jppf.node.protocol.TaskBundle bundle) Prepare the task bundle's data that will be sent back to the server.- Parameters:
bundle- the bundle to process.
-
finalizeBundleData
protected void finalizeBundleData(org.jppf.node.protocol.TaskBundle bundle, List<org.jppf.node.protocol.Task<?>> tasks) Compute the task bundle's data before it is sent back to the server.- Parameters:
bundle- the bundle to process.tasks- the list of tasks after they have been executed.
-