org.javagroups.service.lease
Class LeaseRequestHeader
java.lang.Object
|
+--org.javagroups.Header
|
+--org.javagroups.service.lease.LeaseRequestHeader
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
- public class LeaseRequestHeader
- extends Header
Message header that represents lease request. Request has type. Requests for
new lease or renew lease contain desired lease duration and entity requesting
the lease, cancel requests does not contain lease duration, only entity
cancelling lease. Resource identifier is sent as message payload.
- Author:
- Roman Rokytskyy (rrokytskyy@acm.org)
- See Also:
- Serialized Form
Constructor Summary |
LeaseRequestHeader()
Constructs empty header. |
LeaseRequestHeader(int headerType,
long duration,
boolean isAbsolute,
java.lang.Object tenant)
Create lease request header of the specified type with specified
duration. |
Method Summary |
long |
getDuration()
Get requested duration of a lease. |
java.lang.Object |
getTenant()
Get identifier of an object that requests the lease. |
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 stream. |
void |
writeExternal(java.io.ObjectOutput out)
Write state of this object into object output stream. |
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
NEW_LEASE_REQUEST
public static final int NEW_LEASE_REQUEST
RENEW_LEASE_REQUEST
public static final int RENEW_LEASE_REQUEST
CANCEL_LEASE_REQUEST
public static final int CANCEL_LEASE_REQUEST
LeaseRequestHeader
public LeaseRequestHeader()
- Constructs empty header. Only for
Externalizable
implementation. If object was created using this method, there is no
other way to initialize this object except using
readExternal(ObjectInput)
method.
LeaseRequestHeader
public LeaseRequestHeader(int headerType,
long duration,
boolean isAbsolute,
java.lang.Object tenant)
- Create lease request header of the specified type with specified
duration.
getType
public int getType()
- Get type of lease request.
getDuration
public long getDuration()
- Get requested duration of a lease. If type of lease request is
CANCEL_LEASE_REQUEST
value is ignored.
- Returns:
- requested duration of lease in milliseconds.
isAbsolute
public boolean isAbsolute()
- Check if duration is relative or absolute. If type of lease reques is
CANCEL_LEASE_REQUEST
value is ignored.
- Returns:
true
if duration is absolute, otherwise
false
.
getTenant
public java.lang.Object getTenant()
- Get identifier of an object that requests the lease.
- Returns:
- object identifying entity that requests lease.
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Read state of this object from object input stream. Format of data in
the stream is:
- headerType - int;
- duration - long (not applicable for lease ;
- isAbsolute - boolean;
- tenant - Object.
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Write state of this object into object output stream. Format of data in
the stream is:
- headerType - int;
- duration - long;
- isAbsolute - boolean;
- tenant - Object.
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.