org.jppf.server.nio.nodeserver
Class AbstractNodeMessage

java.lang.Object
  extended by org.jppf.server.nio.nodeserver.AbstractNodeMessage
Direct Known Subclasses:
LocalNodeMessage, RemoteNodeMessage

public abstract class AbstractNodeMessage
extends Object

Common abstract superclass representing a message sent or received by a node. A message is the transformation of a job into an more easily transportable format.

Author:
Laurent Cohen

Field Summary
protected  JPPFTaskBundle bundle
          The latest bundle that was sent or received.
protected  int count
          The current count of bytes sent or received.
protected  int length
          The total length of data to send or receive.
protected  LinkedList<DataLocation> locations
          The data location objects abstracting the data to send or receive.
protected  int nbObjects
          The number of objects toread or write.
protected  int position
          The current position in the list of data locations.
 
Constructor Summary
AbstractNodeMessage()
           
 
Method Summary
 void addLocation(DataLocation location)
          Add a location to the data locations of this message.
 JPPFTaskBundle getBundle()
          Get the latest bundle that was sent or received.
 int getLength()
          Get the total length of data to send or receive.
 List<DataLocation> getLocations()
          Get the data location objects abstracting the data to send or receive.
 boolean read(ChannelWrapper<?> wrapper)
          Read data from the channel.
protected abstract  boolean readNextObject(ChannelWrapper<?> wrapper)
          Read the next serializable object from the specified channel.
 void setBundle(JPPFTaskBundle bundle)
          Set the latest bundle that was sent or received.
 String toString()
          
 boolean write(ChannelWrapper<?> wrapper)
          Read data from the channel.
protected abstract  boolean writeNextObject(ChannelWrapper<?> wrapper)
          Write the next object to the specified channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

count

protected int count
The current count of bytes sent or received.


length

protected int length
The total length of data to send or receive.


locations

protected LinkedList<DataLocation> locations
The data location objects abstracting the data to send or receive.


position

protected int position
The current position in the list of data locations.


nbObjects

protected int nbObjects
The number of objects toread or write.


bundle

protected JPPFTaskBundle bundle
The latest bundle that was sent or received.

Constructor Detail

AbstractNodeMessage

public AbstractNodeMessage()
Method Detail

addLocation

public void addLocation(DataLocation location)
Add a location to the data locations of this message.

Parameters:
location - the location to add.

read

public boolean read(ChannelWrapper<?> wrapper)
             throws Exception
Read data from the channel.

Parameters:
wrapper - the channel to read from.
Returns:
true if the data has been completely read from the channel, false otherwise.
Throws:
Exception - if an IO error occurs.

readNextObject

protected abstract boolean readNextObject(ChannelWrapper<?> wrapper)
                                   throws Exception
Read the next serializable object from the specified channel.

Parameters:
wrapper - the channel to read from.
Returns:
true if the object has been completely read from the channel, false otherwise.
Throws:
Exception - if an IO error occurs.

write

public boolean write(ChannelWrapper<?> wrapper)
              throws Exception
Read data from the channel.

Parameters:
wrapper - the channel to write to.
Returns:
true if the data has been completely written the channel, false otherwise.
Throws:
Exception - if an IO error occurs.

writeNextObject

protected abstract boolean writeNextObject(ChannelWrapper<?> wrapper)
                                    throws Exception
Write the next object to the specified channel.

Parameters:
wrapper - the channel to write to.
Returns:
true if the object has been completely written the channel, false otherwise.
Throws:
Exception - if an IO error occurs.

getLocations

public List<DataLocation> getLocations()
Get the data location objects abstracting the data to send or receive.

Returns:
a list of DataLocation objects.

getLength

public int getLength()
Get the total length of data to send or receive.

Returns:
the length as an int.

getBundle

public JPPFTaskBundle getBundle()
Get the latest bundle that was sent or received.

Returns:
a JPPFTaskBundle instance.

setBundle

public void setBundle(JPPFTaskBundle bundle)
Set the latest bundle that was sent or received.

Parameters:
bundle - - a JPPFTaskBundle instance.

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2005-2010 JPPF Team.