org.javagroups.service.lease
Class LeaseResponseHeader
java.lang.Object
|
+--org.javagroups.Header
|
+--org.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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
HEADER_KEY
public static final java.lang.String HEADER_KEY
NONE
public static final int NONE
LEASE_GRANTED
public static final int LEASE_GRANTED
LEASE_RENEWED
public static final int LEASE_RENEWED
LEASE_CANCELED
public static final int LEASE_CANCELED
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
.
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.
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Write state of this object into object output.
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.