async.common
Interface Message


public interface Message

A serialization interface for objects that are to be sent over the network by some transport protocol.

Author:
Michael Parker

Method Summary
 boolean serialize(java.nio.ByteBuffer bb, ProcessReadyCallback prc)
          This method is invoked when the transport protocol is ready to serialize the next part of this message to send it over the network.
 

Method Detail

serialize

boolean serialize(java.nio.ByteBuffer bb,
                  ProcessReadyCallback prc)
This method is invoked when the transport protocol is ready to serialize the next part of this message to send it over the network. If the implementor of this method is ready to fill the buffer immediately, then it should do so and return true. Note that after the client fills the buffer, its flip method should not be invoked. If the client returns true but does not place any data in the buffer, the transport protocol instance will assume that no more serialized data exists, and move on to the next Message in the queue. Otherwise, if the implementor is not ready to fill bb, it should return false and keep a reference to the provided ProcessReadyCallback argument. When method nowReady is invoked on this object, then the transport protocol will invoke this method again.

Parameters:
bb - the ByteBuffer containing the data to send
prc - the object through which the client later notifies the transport protocol that it is ready to fill bb if this method returns false
Returns:
true if this method was ready to fill the buffer, false otherwise