Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weblogic.cluster.singleton
Class DatabaseLeasingBasis

    java.lang.Object
      weblogic.cluster.singleton.DatabaseLeasingBasis

All Implemented Interfaces:
  LeasingBasis

    public class DatabaseLeasingBasis

extends Object
implements LeasingBasis

`LeasingBasis` that leverages an HA-database for lease ownership. Assumes transactional behaviour of SQL-queries.

Field Summary
`protected weblogic.management.configuration.JDBCSystemResourceMBean` | `jdbcResource`
`protected int` | `queryTimeoutSeconds`
`protected String` | `TABLE_NAME`

Constructor Summary
`DatabaseLeasingBasis(weblogic.management.configuration.JDBCSystemResourceMBean jdbcResource, int unresponsiveTimeout, String tableName)`

Method Summary
`protected int` | `abdicateLease(String leaseName, String owner)`
`boolean` | `acquire(String leaseName, String owner, int leaseTimeout)` Attempts to claim immediate ownership of a lease for this server.
`protected int` | `acquireLease(String leaseName, String owner)`
`protected int` | `assumeLease(String leaseName, String owner, int leaseTimeout)`
`protected void` | `closePreparedStatement(PreparedStatement ps)`
`protected void` | `closeResultSet(ResultSet rs)`
`protected void` | `closeSQLConnection(Connection con)`
`static LeasingBasis` | `createBasis(weblogic.management.configuration.ServerMBean server, weblogic.management.configuration.JDBCSystemResourceMBean jdbcResource, int unresponsiveTimeout, String tableName)` Check to make sure the database is reachable.
`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)`
`protected Connection` | `getJDBCConnection()`
`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.
`protected int` | `renewAllLeases(String owner, int healthCheckPeriod)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jdbcResource

    protected final weblogic.management.configuration.JDBCSystemResourceMBean jdbcResource

### TABLE_NAME

    protected final String TABLE_NAME

### queryTimeoutSeconds

    protected final int queryTimeoutSeconds

Constructor Detail

### DatabaseLeasingBasis

    public DatabaseLeasingBasis(weblogic.management.configuration.JDBCSystemResourceMBean jdbcResource,
                                int unresponsiveTimeout,
                                String tableName)

Method Detail

### acquire

    public boolean acquire(String leaseName,
                           String owner,
                           int leaseTimeout)
                    throws LeasingException

  Description copied from interface: `LeasingBasis`
  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.

  Specified by:
    `acquire` in interface `LeasingBasis`
    `leaseTimeout` - in milliseconds
  Returns:
    true if the lease was aquired
  Throws:
    `LeasingException`

### release

    public void release(String leaseName,
                        String owner)
                 throws IOException

  Description copied from interface: `LeasingBasis`
  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.

  Specified by:
    `release` in interface `LeasingBasis`
  Throws:
    `IOException`

### renewAllLeases

    public int renewAllLeases(int healthCheckPeriod,
                              String owner)
                       throws MissedHeartbeatException

  Description copied from interface: `LeasingBasis`
  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.

  Specified by:
    `renewAllLeases` in interface `LeasingBasis`
  Parameters:
    `healthCheckPeriod` - in milliseconds
  Returns:
    number of owned leases
  Throws:
    `MissedHeartbeatException`

### renewAllLeases

    protected int renewAllLeases(String owner,
                                 int healthCheckPeriod)

### abdicateLease

    protected int abdicateLease(String leaseName,
                                String owner)

### acquireLease

    protected int acquireLease(String leaseName,
                               String owner)

### assumeLease

    protected int assumeLease(String leaseName,
                              String owner,
                              int leaseTimeout)

### findPreviousOwner

    public String findPreviousOwner(String leaseName)
                             throws IOException

  Specified by:
    `findPreviousOwner` in interface `LeasingBasis`
  Throws:
    `IOException`

### findOwner

    public String findOwner(String leaseName)
                     throws IOException

  Description copied from interface: `LeasingBasis`
  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.

  Specified by:
    `findOwner` in interface `LeasingBasis`
  Returns:
    name of the owner
  Throws:
    `IOException`

### findExpiredLeases

    public String[] findExpiredLeases(int gracePeriod)

  Description copied from interface: `LeasingBasis`
  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.

  Specified by:
    `findExpiredLeases` in interface `LeasingBasis`
  Parameters:
    `gracePeriod` - in milliseconds

### closePreparedStatement

    protected void closePreparedStatement(PreparedStatement ps)

### closeSQLConnection

    protected void closeSQLConnection(Connection con)

### closeResultSet

    protected void closeResultSet(ResultSet rs)

### getJDBCConnection

    protected Connection getJDBCConnection()
                                    throws SQLException

  Throws:
    `SQLException`

### createBasis

    public static LeasingBasis createBasis(weblogic.management.configuration.ServerMBean server,
                                           weblogic.management.configuration.JDBCSystemResourceMBean jdbcResource,
                                           int unresponsiveTimeout,
                                           String tableName)
                                    throws weblogic.server.ServiceFailureException

  Check to make sure the database is reachable.

  Throws:
    `weblogic.server.ServiceFailureException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://e-docs.bea.com/wls/docs92 Copyright 2006 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD