Rio Project 4.2 API Documentation



org.rioproject.resources.servicecore
Class ServiceResource

java.lang.Object
  extended by org.rioproject.resources.servicecore.ServiceResource
All Implemented Interfaces:
LeasedResource

public class ServiceResource
extends Object
implements LeasedResource

Leased service resources to be used with LeaseDurationPolicy and/or LeaseManager

Author:
Dennis Reedy

Field Summary
protected  Uuid cookie
           
protected  long expiration
           
 Lease lease
           
 Object resource
           
 
Constructor Summary
ServiceResource(Object resource)
          Create a ServiceResource
 
Method Summary
 boolean equals(Object o)
          Overrides equals() to be based on the value of the cookie attribute
 Uuid getCookie()
          Returns a unique identifier that can be used by the grantor of the resource to identify it
 long getExpiration()
          Returns the expiration time of the leased resource.
 Object getResource()
          Returns the resource that is being leased
 int hashCode()
          Overrides hashcode() to be based on the hashcode of the cookie attribute
 void setExpiration(long expiration)
          Changes the expiration time of the leased resource.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cookie

protected Uuid cookie

expiration

protected long expiration

lease

public Lease lease

resource

public Object resource
Constructor Detail

ServiceResource

public ServiceResource(Object resource)
Create a ServiceResource

Parameters:
resource - The resource being leased
Method Detail

getExpiration

public long getExpiration()
Returns the expiration time of the leased resource.

Specified by:
getExpiration in interface LeasedResource
Returns:
The expiration time in milliseconds since the beginning of the epoch

setExpiration

public void setExpiration(long expiration)
Changes the expiration time of the leased resource.

Specified by:
setExpiration in interface LeasedResource
Parameters:
expiration - The new expiration time in milliseconds since the beginning of the epoch

getCookie

public Uuid getCookie()
Returns a unique identifier that can be used by the grantor of the resource to identify it

Specified by:
getCookie in interface LeasedResource

getResource

public Object getResource()
Returns the resource that is being leased

Returns:
The actual resource

equals

public boolean equals(Object o)
Overrides equals() to be based on the value of the cookie attribute

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides hashcode() to be based on the hashcode of the cookie attribute

Overrides:
hashCode in class Object

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.