|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweblogic.cluster.singleton.LeaseManager
public class LeaseManager
Implementation of the Leasing
interface.
Field Summary | |
---|---|
static String |
DELIMITER
|
Constructor Summary | |
---|---|
LeaseManager(LeasingBasis basis,
int heartbeatPeriod,
int healthCheckPeriod,
int gracePeriod,
String leaseType)
Create a new LeaseManager . |
Method Summary | |
---|---|
void |
acquire(String leaseName,
LeaseObtainedListener listener)
Registers interest in claiming ownership of a lease for this server whenever it becomes available. |
void |
addLeaseLostListener(LeaseLostListener listener)
Add a LeaseLostListener. |
String[] |
findExpiredLeases()
Returns a list of the servers that have consistently missed sending heartbeats in a timely manner, AND have gone past their grace period. |
String |
findOwner(String leaseName)
Returns the identity of the server that currently owns the lease. |
String |
findPreviousOwner(String leaseName)
|
int |
getGracePeriod()
|
static String |
getOwnerIdentity(weblogic.protocol.ServerIdentity id)
|
static String |
getServerNameFromOwnerIdentity(String ownerIdentity)
|
void |
release(String leaseName)
If the lease is owned by this server, attempts to give up ownership. |
void |
removeLeaseLostListener(LeaseLostListener listener)
Remove a LeaseLostListener. |
void |
start()
|
void |
stop()
During shutdown operation, LeaseManager should give up his leases so that some other server in the cluster can take over the role. |
void |
timerExpired(weblogic.timers.Timer timer)
Regularly called by the timer service. |
boolean |
tryAcquire(String leaseName)
Attempts to claim immediate ownership of a lease for this server. |
void |
voidLeases()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DELIMITER
Constructor Detail |
---|
public LeaseManager(LeasingBasis basis, int heartbeatPeriod, int healthCheckPeriod, int gracePeriod, String leaseType)
LeaseManager
.
basis
- The underlying implementation of Leasing.heartbeatPeriod
- The rate at which heartbeats are sent in mshealthCheckPeriod
- If a server is unable to send a
heartbeat within the healthCheckPeriod in ms, it must take
corrective action.gracePeriod
- How long to wait, in ms, after the last time
the previous owner has successfully sent a heartbeat before it is
permissible migrate a server based on that lease.leaseType
- the type of the lease, in the form of a unique string.
For example, 'singletonService', 'server', 'timer', 'ejbtimer', etc.
All leases of a particular type should have the same leaseType.Method Detail |
---|
public boolean tryAcquire(String leaseName) throws LeasingException
tryAcquire
in interface Leasing
LeasingException
- if this server is already waiting to get
the lease (through Leasing.acquire(java.lang.String, weblogic.cluster.singleton.LeaseObtainedListener)
) or if there were
infrastructure problems trying to get ownership.public void acquire(String leaseName, LeaseObtainedListener listener) throws LeasingException
acquire
in interface Leasing
LeasingException
- if this server is already waiting to get
the lease (through a previous call to lease()). Will callback via
LeaseObtainedListener
with an exception if there are
infrastructure problems obtaining the lease. This callback will
NOT cancel the interest in claiming ownership. The leaser must do
so themselves via release.public void release(String leaseName) throws LeasingException
release
in interface Leasing
LeasingException
- if infrastructure problems make it
impossible to access the lease.public String findOwner(String leaseName) throws LeasingException
findOwner
in interface Leasing
LeasingException
- if infrastructure problems make it
impossible to determine who owns the lease.public String findPreviousOwner(String leaseName) throws LeasingException
LeasingException
public static String getOwnerIdentity(weblogic.protocol.ServerIdentity id)
public static String getServerNameFromOwnerIdentity(String ownerIdentity)
public void addLeaseLostListener(LeaseLostListener listener)
addLeaseLostListener
in interface Leasing
public void removeLeaseLostListener(LeaseLostListener listener)
removeLeaseLostListener
in interface Leasing
public int getGracePeriod()
public String[] findExpiredLeases()
Leasing services also include a method LeaseManager.findExpiredLeases()
that returns a list of all servers in the
cluster that have consistently missed sending heartbeats in a
timely manner. 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. This method might be used by a centralized control
process, such as a Cluster Master, to migrate failed servers.
public void stop()
public void start()
public void voidLeases()
public void timerExpired(weblogic.timers.Timer timer)
timerExpired
in interface weblogic.timers.TimerListener
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs92 Copyright 2006 BEA Systems Inc. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |