Package org.jppf.nio
Class AbstractNioMessage
java.lang.Object
org.jppf.nio.AbstractNioMessageBase
org.jppf.nio.AbstractNioMessage
- All Implemented Interfaces:
NioMessage
- Direct Known Subclasses:
ClassLoaderNioMessage
Common abstract superclass representing a message sent or received by a channel.
A message is the transformation of a sequence of objects into a more easily transportable format.
- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<DataLocation>The data location objects abstracting the data to send or receive.protected intThe number of objects to read or write.protected intThe current position in the list of data locations.Fields inherited from class org.jppf.nio.AbstractNioMessageBase
channel, channelReadCount, channelWriteCount, count, currentDataLocation, currentLength, currentLengthObject, currentObject, lengthBuf, resetCurrentLength, ssl, sslHandler, sslHandlerReadCount, sslHandlerWriteCountFields inherited from interface org.jppf.nio.NioMessage
READ, WRITE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNioMessage(NioContext channel) Initialize this nio message. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocation(DataLocation location) Add a location to the data locations of this message.protected voidActions to take after the first object in the message has been fully read.protected voidActions to take before the first object in the message is written.Get the data location objects abstracting the data to send or receive.booleanread()Read data from a channel.protected booleanRead the next serializable object from the specified channel.toString()booleanwrite()Read data from a channel.protected booleanWrite the next object to the specified channel.Methods inherited from class org.jppf.nio.AbstractNioMessageBase
getChannelReadCount, getChannelWriteCount, getCurrentDataLocation, isSSL, updateCounts
-
Field Details
-
locations
The data location objects abstracting the data to send or receive. -
position
protected int positionThe current position in the list of data locations. -
nbObjects
protected int nbObjectsThe number of objects to read or write.
-
-
Constructor Details
-
AbstractNioMessage
Initialize this nio message.- Parameters:
channel- the channel to read from or write to.
-
-
Method Details
-
addLocation
Add a location to the data locations of this message.- Parameters:
location- the location to add.
-
read
Description copied from interface:NioMessageRead data from a channel.- Returns:
- true if the data has been completely read from the channel, false otherwise.
- Throws:
Exception- if an IO error occurs.
-
write
Description copied from interface:NioMessageRead data from a channel.- Returns:
- true if the data has been completely written the channel, false otherwise.
- Throws:
Exception- if an IO error occurs.
-
readNextObject
Read the next serializable object from the specified channel.- Returns:
- true if the object has been completely read from the channel, false otherwise.
- Throws:
Exception- if an IO error occurs.
-
writeNextObject
Write the next object to the specified channel.- Returns:
- true if the object has been completely written the channel, false otherwise.
- Throws:
Exception- if an IO error occurs.
-
getLocations
Get the data location objects abstracting the data to send or receive.- Returns:
- a list of
DataLocationobjects.
-
afterFirstRead
Actions to take after the first object in the message has been fully read.- Throws:
Exception- if an IO error occurs.
-
beforeFirstWrite
Actions to take before the first object in the message is written.- Throws:
Exception- if an IO error occurs.
-
toString
-