org.javagroups.service.lease
Class LeaseResponseHeader

java.lang.Object
  extended byorg.javagroups.Header
      extended byorg.javagroups.service.lease.LeaseResponseHeader
All Implemented Interfaces:
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable

public class LeaseResponseHeader
extends Header

Message header representing service response. Presence of this header in message means that previous request succeeded. Header type determines what type of request was satisfied. If this header represents new lease or lease renewal, granted lease duration is passed within. Also each header contains entity that requested factory operation.

Author:
Roman Rokytskyy (rrokytskyy@acm.org)
See Also:
Serialized Form

Field Summary
static java.lang.String HEADER_KEY
           
static int LEASE_CANCELED
           
static int LEASE_GRANTED
           
static int LEASE_RENEWED
           
static int NONE
           
 
Fields inherited from class org.javagroups.Header
HDR_OVERHEAD
 
Constructor Summary
LeaseResponseHeader()
          Create uninitialized instance of this class.
LeaseResponseHeader(int headerType, long duration, boolean isAbsolute, java.lang.Object tenant)
          Create instance of this class of type either LEASE_GRANTED or LEASE_RENEWED.
LeaseResponseHeader(int headerType, java.lang.Object tenant)
          Create instance of this class of type LEASE_CANCELED or LEASE_RENEWED.
 
Method Summary
 long getDuration()
          Get requested duration of a lease.
 java.lang.Object getTenant()
          Get tenant, to which this request is addressed to.
 int getType()
          Get type of lease request.
 boolean isAbsolute()
          Check if duration is relative or absolute.
 void readExternal(java.io.ObjectInput in)
          Read state of this object from object input.
 void writeExternal(java.io.ObjectOutput out)
          Write state of this object into object output.
 
Methods inherited from class org.javagroups.Header
size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HEADER_KEY

public static final java.lang.String HEADER_KEY
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

LEASE_GRANTED

public static final int LEASE_GRANTED
See Also:
Constant Field Values

LEASE_RENEWED

public static final int LEASE_RENEWED
See Also:
Constant Field Values

LEASE_CANCELED

public static final int LEASE_CANCELED
See Also:
Constant Field Values
Constructor Detail

LeaseResponseHeader

public LeaseResponseHeader()
Create uninitialized instance of this class. This constructor is used for implementation of Externalizable interface. There is no other way to set state of this object except reading it from object input using readExternal(java.io.ObjectInput) method.


LeaseResponseHeader

public LeaseResponseHeader(int headerType,
                           java.lang.Object tenant)
Create instance of this class of type LEASE_CANCELED or LEASE_RENEWED.


LeaseResponseHeader

public LeaseResponseHeader(int headerType,
                           long duration,
                           boolean isAbsolute,
                           java.lang.Object tenant)
Create instance of this class of type either LEASE_GRANTED or LEASE_RENEWED.

Method Detail

getType

public int getType()
Get type of lease request.


getDuration

public long getDuration()
Get requested duration of a lease.

Returns:
requested duration of lease in milliseconds.

isAbsolute

public boolean isAbsolute()
Check if duration is relative or absolute.

Returns:
true if duration is absolute, otherwise false.

getTenant

public java.lang.Object getTenant()
Get tenant, to which this request is addressed to.


readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read state of this object from object input.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write state of this object into object output.

Throws:
java.io.IOException


Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.