jgroup.relacs.mss
Class FragmentHeader

java.lang.Object
  extended by jgroup.relacs.mss.FragmentHeader
All Implemented Interfaces:
MssConstants, MssTag

public final class FragmentHeader
extends java.lang.Object
implements MssTag, MssConstants

This class contains the mss level fragment header data.

Since:
Jgroup 1.2
Author:
Hein Meling

Field Summary
 
Fields inherited from interface jgroup.relacs.mss.MssTag
ASYN, CONGESTION, EXTERNFC, FWDROUTING, IAMALIVE, JG, LOCALFC, NACK, NOTLASTFRAGMENT, PING_OBJECT, QSYN, REMOTENACK, ROUTING, SENT, SENTNACK, SYN, TAGTYPE, TOPOLOGY
 
Fields inherited from interface jgroup.relacs.mss.MssConstants
ALL, EHANDLER_PRIORITY, HEADER_SIZE, MINIMUM_ALIVE_VALUE, MSS_HEADER_SIZE, MSSUSER_PRIORITY, NACKSUPPRESSION, NI_PRIORITY, OVERHEAD_SIZE, ROUTING_ENABLED, TRAILER_SIZE, UNDEF, UNREACHABLE
 
Method Summary
 void broadcastOff()
           
 byte[] getFragment()
          Returns the message fragment associated with this header.
 int getFragmentLength()
          Returns the length of the fragment associated with this header.
 int getIncarnationId()
          Returns incarnation identifier for the sender of this message.
 MssHost getSender()
          Returns the sender of this message fragment.
 byte getTag()
          Returns the tag associated with this message.
 boolean isBroadcast()
          Returns true if this message is a broadcast message.
 boolean isLocal()
          Returns true if the sender of this message is the local host.
static void marshal(boolean broadcast, int fragId, byte[] outstream)
          Marshals the given FragmentHeader values into the specified byte[] outstream, without creating an object.
static byte[] marshal(byte tag, boolean broadcast, int fragId)
          Marshals the given FragmentHeader values into a byte array and returns it.
static void marshal(byte tag, boolean broadcast, int fragId, byte[] outstream)
          Marshals the given FragmentHeader values into the specified byte[] outstream, without creating an object.
 void setTag(byte tag)
          Set the tag associated with this message.
 java.lang.String toString()
          Print the content of the FragmentHeader.
static FragmentHeader unmarshal(jgroup.relacs.mss.MssDS mssds, byte[] instream, int fragLen)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

marshal

public static byte[] marshal(byte tag,
                             boolean broadcast,
                             int fragId)
Marshals the given FragmentHeader values into a byte array and returns it. The size of the array is equal to the fragment header standard size. This method is useful if we want to send a single message fragment, in which only the tag reveals the semantics of the message. For example to notify others of some event, that does not need additional data. At the sender side, we don't keep any of the input parameters, we just marshal it directly into the created outstream byte array that is returned from this method.


marshal

public static void marshal(boolean broadcast,
                           int fragId,
                           byte[] outstream)
Marshals the given FragmentHeader values into the specified byte[] outstream, without creating an object. This marshal method does not change the sender related fields, such as the inet address, port and incarnation identifier. It will only set the broadcast and fragment identifier values.

At the sender side, we don't keep any of the input parameters, we just marshal it directly into the outstream byte array.


marshal

public static void marshal(byte tag,
                           boolean broadcast,
                           int fragId,
                           byte[] outstream)
Marshals the given FragmentHeader values into the specified byte[] outstream, without creating an object.

At the sender side, we don't keep any of the input parameters, we just marshal it directly into the outstream byte array.


unmarshal

public static FragmentHeader unmarshal(jgroup.relacs.mss.MssDS mssds,
                                       byte[] instream,
                                       int fragLen)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException,
                                       JgroupException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
JgroupException

getTag

public byte getTag()
Returns the tag associated with this message.


setTag

public void setTag(byte tag)
Set the tag associated with this message.


getFragment

public byte[] getFragment()
Returns the message fragment associated with this header.


getFragmentLength

public int getFragmentLength()
Returns the length of the fragment associated with this header.


getSender

public MssHost getSender()
Returns the sender of this message fragment.


getIncarnationId

public int getIncarnationId()
Returns incarnation identifier for the sender of this message.


isLocal

public boolean isLocal()
Returns true if the sender of this message is the local host.


isBroadcast

public boolean isBroadcast()
Returns true if this message is a broadcast message. False is returned otherwise.


broadcastOff

public void broadcastOff()

toString

public java.lang.String toString()
Print the content of the FragmentHeader.

Overrides:
toString in class java.lang.Object


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.