one.world.binding
Class LeaseManager

java.lang.Object
  |
  +--one.world.core.Component
        |
        +--one.world.binding.LeaseManager
All Implemented Interfaces:
Serializable

public final class LeaseManager
extends Component

Implementation of a lease manager. A lease manager is responsible for managing the leases governing access to leased resources.

Leased resources are provided by resource managers. When a resource manager receives a binding request for one of the resources it manages, it acquires the corresponding lease from its lease manager through an acquire lease event. The lease manager then handles lease renewal and cancellation. It notifies the resource manager of cancellation through a canceled lease event. Resource managers may receive several canceled lease events for the same resource and should simply ignore repeated canceled lease events.

Note that when the lease manager sends a canceled lease event to the resource manager, the canceled lease event's closure is the same as the closure of the corresponding acquire lease event.

Imported and Exported Event Handlers

Exported event handler(s):

request
Handles lease events requesting to acquire a lease.

Version:
$Revision: 1.22 $
See Also:
BindingRequest, LeaseEvent, Serialized Form

Inner Class Summary
static class LeaseManager.Acquire
          The event handler for processing lease acquisition.
 
Inner classes inherited from class one.world.core.Component
Component.HandlerReference, Component.Importer
 
Constructor Summary
LeaseManager(Environment env)
          Create a new instance of LeaseManager.
 
Method Summary
static void acquire(BindingRequest request, EventHandler resource, EventHandler leaseManager)
          Acquire a lease.
static void acquire(BindingRequest request, EventHandler resource, EventHandler resourceManager, EventHandler leaseManager)
          Acquire a lease.
 ComponentDescriptor getDescriptor()
          Get the component descriptor.
 
Methods inherited from class one.world.core.Component
declareExported, declareImported, equals, eventHandlers, getDescriptor, getEnvironment, getLinkedHandlers, getLinkedNumber, getTimer, hasEventHandler, hashCode, isFullyLinked, isLinked, isSealed, link, link, run, seal, unbox, undeclare, unlink, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeaseManager

public LeaseManager(Environment env)
Create a new instance of LeaseManager.
Parameters:
env - The environment for the new instance.
Method Detail

getDescriptor

public ComponentDescriptor getDescriptor()
Get the component descriptor.
Overrides:
getDescriptor in class Component
Following copied from class: one.world.core.Component
Returns:
The component descriptor for this component.

acquire

public static void acquire(BindingRequest request,
                           EventHandler resource,
                           EventHandler leaseManager)
Acquire a lease. Based on the specified binding request, this method sends an acquire lease event to the specified lease manager. It asynchronously processes the response. If the lease is granted, it sends an appropriate binding response to the source of the binding request. If the lease is not granted, it sends a lease canceled event to the specified resource.

Calling this method is equivalent to calling

   leaseManager.handle(new
     LeaseEvent(new Acquire(request, resource), null,
                LeaseEvent.ACQUIRE, resource,
                request.descriptor, request.duration));
 

The specified binding request must be a valid binding request. The specified resource must correctly handle canceled lease events. The specified lease manager must correctly handle acquire lease events.

Parameters:
request - The binding request.
resource - The corresponding resource.
leaseManager - The lease manager.
See Also:
LeaseManager.Acquire

acquire

public static void acquire(BindingRequest request,
                           EventHandler resource,
                           EventHandler resourceManager,
                           EventHandler leaseManager)
Acquire a lease. Based on the specified binding request, this method sends an acquire lease event to the specified lease manager. It asynchronously processes the response. If the lease is granted, it sends an appropriate binding response to the source of the binding request. If the lease is not granted, it sends a lease canceled event to the specified resource.

Calling this method is equivalent to calling

   leaseManager.handle(new
     LeaseEvent(new Acquire(request, resource), null,
                LeaseEvent.ACQUIRE, resourceManager,
                request.descriptor, request.duration));
 

The specified binding request must be a valid binding request. The specified resource manager must correctly handle canceled lease events. The specified lease manager must correctly handle acquire lease events.

Parameters:
request - The binding request.
resource - The corresponding resource.
resourceManager - The resource manager.
leaseManager - The lease manager.
See Also:
LeaseManager.Acquire


(C) Copyright 2001 UW CSE