Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.5)

Part Number E13941-05

weblogic.cluster.singleton
Interface LeasingBasis

All Known Subinterfaces:
RemoteLeasingBasis
All Known Implementing Classes:
DatabaseLeasingBasis, RemoteLeasingBasisImpl, ReplicatedLeasingBasis, SimpleLeasingBasis

public interface LeasingBasis

A LeasingBasis provides the underpinnings for implementing the LeaseManager. Different LeasingBasis-es with different characteristics can be plugged in. For example, a LeasingBasis might be implemented against a backing database, against a uniquely-chosen file store, or from first principles using a distributed agreement algorithm.


Method Summary
 boolean acquire(String leaseName, String owner, int leaseTimeout)
          Attempts to claim immediate ownership of a lease for this server.
 String[] findExpiredLeases(int gracePeriod)
          Returns a list of the servers that have consistently missed sending heartbeats in a timely manner, and failed to do so for longer than their grace period.
 String findOwner(String leaseName)
          Returns the identity of the server that currently owns the lease.
 String findPreviousOwner(String leaseName)
           
 void release(String leaseName, String owner)
          If the lease is owned by this server, attempts to give up ownership.
 int renewAllLeases(int healthCheckPeriod, String owner)
          Attempts to send a heartbeat to prove the health of the server.
 int renewLeases(String owner, Set leases, int healthCheckPeriod)
          Attempts to renew all the currently held leases.
 

Method Detail

acquire

boolean acquire(String leaseName,
                String owner,
                int leaseTimeout)
                throws IOException,
                       LeasingException
Attempts to claim immediate ownership of a lease for this server. Returns true if the lease was successfully claimed or if it is already owned by the server. Returns false if the lease is owned by another server. Throws a LeasingException if there were infrastructure problems trying to get ownership. The leaseTimeout specifies how long the lease will last.

Parameters:
leaseName -
owner -
leaseTimeout - in milliseconds
Returns:
true if the lease was aquired
Throws:
IOException
LeasingException

release

void release(String leaseName,
             String owner)
             throws IOException
If the lease is owned by this server, attempts to give up ownership. Otherwise does nothing. Throws a LeasingException if infrastructure problems make it impossible to access the lease.

Parameters:
leaseName -
owner -
Throws:
IOException

findOwner

String findOwner(String leaseName)
                 throws IOException
Returns the identity of the server that currently owns the lease. Returns null if the lease is not owned. The lease is not considered to be owned if it has been claimed by a server that has missed heartbeats. This is a best-effort result in that the answer may change after the value is returned. Throws a LeasingException if infrastructure problems make it impossible to determine who owns the lease.

Parameters:
leaseName -
Returns:
name of the owner
Throws:
IOException

findPreviousOwner

String findPreviousOwner(String leaseName)
                         throws IOException
Throws:
IOException

renewLeases

int renewLeases(String owner,
                Set leases,
                int healthCheckPeriod)
                throws IOException,
                       MissedHeartbeatException
Attempts to renew all the currently held leases.

Parameters:
leases - to be renewed
owner -
healthCheckPeriod - in milliseconds
Returns:
number of leases renewed
Throws:
IOException
MissedHeartbeatException

renewAllLeases

int renewAllLeases(int healthCheckPeriod,
                   String owner)
                   throws IOException,
                          MissedHeartbeatException
Attempts to send a heartbeat to prove the health of the server. Determines whether or not the heartbeat was sent in a timely manner. This determination should ideally be precise. If it is not, then it has to err on the safe side, i.e., it is better to falsely indicate that a Heartbeat was missed than to fail to indicate that a Heartbeat was missed. The heartbeat is sent for the next period even if the last one was missed. This minimizes the chances of damage while the system is signaling for corrective action. This is semantically equivalent to renewing all of the outstanding leases.

Parameters:
healthCheckPeriod - in milliseconds
owner -
Returns:
number of owned leases
Throws:
IOException
MissedHeartbeatException

findExpiredLeases

String[] findExpiredLeases(int gracePeriod)
                           throws IOException
Returns a list of the servers that have consistently missed sending heartbeats in a timely manner, and failed to do so for longer than their grace period. INVARIANT: If a server stops heartbeating PERMANENTLY, then it will EVENTUALLY be returned in this list, although there is no guarantee as to how long that will take.

Parameters:
gracePeriod - in milliseconds
Throws:
IOException

Copyright 1996, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.5)

Part Number E13941-05