com.sleepycat.je.rep.utilint
Class BinaryProtocol.Message

java.lang.Object
  extended by com.sleepycat.je.rep.utilint.BinaryProtocol.Message
All Implemented Interfaces:
BinaryProtocol.WireFormatable
Direct Known Subclasses:
BinaryProtocol.SimpleMessage, Protocol.Ack, Protocol.AlternateMatchpoint, Protocol.Entry, Protocol.EntryNotFound, Protocol.Heartbeat, Protocol.HeartbeatResponse, Protocol.ShutdownResponse, Protocol.VLSNMessage
Enclosing class:
BinaryProtocol

public abstract class BinaryProtocol.Message
extends Object
implements BinaryProtocol.WireFormatable

Base message class for all messages exchanged in the protocol. Serialized layout of a message: - opType (short) - size of the body of the message (int) - body of the message - message specific fields

All non-abstract subclasses must implement a constructor with a ByteBuffer argument. This constructor is used during serialization to recreate the Message instance. It's considered good practice to declare all attributes of a message as final. It's a simple way to ensure that the above constructor has initialized all the attributes of the message.


Constructor Summary
BinaryProtocol.Message()
           
 
Method Summary
 ByteBuffer allocateInitializedBuffer(int size)
          Allocate a buffer for the message with the header initialized.
abstract  BinaryProtocol.MessageOp getOp()
           
 boolean match(BinaryProtocol.Message other)
           
 String toString()
           
 ByteBuffer wireFormat()
          The default message consists of the operation enum and just a 0 length size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryProtocol.Message

public BinaryProtocol.Message()
Method Detail

getOp

public abstract BinaryProtocol.MessageOp getOp()

wireFormat

public ByteBuffer wireFormat()
The default message consists of the operation enum and just a 0 length size.

Specified by:
wireFormat in interface BinaryProtocol.WireFormatable

toString

public String toString()
Overrides:
toString in class Object

match

public boolean match(BinaryProtocol.Message other)

allocateInitializedBuffer

public ByteBuffer allocateInitializedBuffer(int size)
Allocate a buffer for the message with the header initialized.

Parameters:
size - size of the message contents following the buffer
Returns:
the initialized buffer


Copyright (c) 2004-2010 Oracle. All rights reserved.