org.jgroups.service.lease
Class LeaseResponseHeader
- Cloneable, Externalizable
public class LeaseResponseHeader
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.
- Roman Rokytskyy (rrokytskyy@acm.org)
LeaseResponseHeader() - Create uninitialized instance of this class.
|
LeaseResponseHeader(int headerType, Object tenant) - Create instance of this class of type
LEASE_CANCELED
or LEASE_RENEWED .
|
LeaseResponseHeader(int headerType, long duration, boolean isAbsolute, Object tenant) - Create instance of this class of type either
LEASE_GRANTED
or LEASE_RENEWED .
|
long | getDuration() - Get requested duration of a lease.
|
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(ObjectInput in) - Read state of this object from object input.
|
void | writeExternal(ObjectOutput out) - Write state of this object into object output.
|
HEADER_KEY
public static final String HEADER_KEY
LEASE_CANCELED
public static final int LEASE_CANCELED
- 3
LEASE_GRANTED
public static final int LEASE_GRANTED
- 1
LEASE_RENEWED
public static final int LEASE_RENEWED
- 2
NONE
public static final int NONE
- 0
LeaseResponseHeader
public LeaseResponseHeader()
Create uninitialized instance of this class. This constructor is used
for implementation of java.io.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,
Object tenant)
Create instance of this class of type LEASE_CANCELED
or LEASE_RENEWED
.
LeaseResponseHeader
public LeaseResponseHeader(int headerType,
long duration,
boolean isAbsolute,
Object tenant)
Create instance of this class of type either LEASE_GRANTED
or LEASE_RENEWED
.
getDuration
public long getDuration()
Get requested duration of a lease.
- requested duration of lease in milliseconds.
getTenant
public Object getTenant()
Get tenant, to which this request is addressed to.
getType
public int getType()
Get type of lease request.
isAbsolute
public boolean isAbsolute()
Check if duration is relative or absolute.
true
if duration is absolute, otherwise
false
.
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
Read state of this object from object input.
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
Write state of this object into object output.
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.