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 QueryHelper

    java.lang.Object
      weblogic.cluster.singleton.QueryHelper

Direct Known Subclasses:
  QueryHelperImpl

    public abstract class QueryHelper

extends Object

Helper class for ClusterMaster to determine servers that are unresponsive and to find lease owners. Queries for lease management. Each lease has an associated timeout which is calculated as (SYSDATE - TIMEOUT). TIMEOUT is initially caclulated as an absolute time in the future (ie. SYSDATE + interval), without renewal TIMEOUT will eventually be in the past and SYSDATE - TIMEOUT will become positive.

Field Summary
`static String` | `TIME_AS_FRACTION_OF_DAY`

Constructor Summary
`QueryHelper()`
`QueryHelper(String tableName, String domainName, String clusterName, int dbType)`

Method Summary
`protected abstract String` | `addToDate(String date, int seconds)` Returns an sql snippet that adds the specifed number of seconds to the date value.
`protected abstract String` | `compareDates(String date1, String date2)` Returns an sql snippet that compares the two specified dates.
`String` | `getAbdicateLeaseQuery(String leaseName, String owner)` Returns a query that removes lease from database, regardless of if it is expired or not.
`String` | `getAcquireLeaseQuery(String leaseName, String owner)` Returns a query that tries to delete any timed-out leases associated with this name.
`String` | `getAssumeLeaseQuery(String leaseName, String owner, int leaseTimeout)` Returns a query that tries to insert a new lease into the database with the given lease name and timeout period.
`protected int` | `getDBType()`
`String` | `getDeleteMachineQuery(String serverName, String machineTableName)` Returns a query that disassociates a server from a machine in the given table
`String` | `getInsertMachineQuery(String serverName, String hostMachine, String machineTableName)` Returns a query that associates a server with a machine in the given table
`String` | `getLeaseOwnerQuery(String leaseName)` Returns a query that returns the owner of the provided lease
`String` | `getPreviousLeaseOwnerQuery(String leaseName)` Returns the current/last owner of the provided lease, regardless of whether it has expired or not.
`String` | `getRenewAllLeasesQuery(String owner, int leaseTimeout)` Returns a query that updates all the leases in database owned by 'owner' to be valid until 'timeoutPeriod' seconds pass.
`String` | `getRenewLeaseQuery(String leaseName, String owner, int leaseTimeout)` Returns a query that updates the provided lease to be valid until 'timeoutPeriod' seconds pass
`String` | `getRetrieveMachineQuery(String serverName, String machineTableName)` Returns a query that finds the machine associated with the given server name
`protected abstract String` | `getTimeFunction()` Returns a query that returns the current time & date, down to at least seconds precision.
`String` | `getUnresponsiveMigratableServersQuery(int gracePeriod)` Returns a query that returns a list of server names that failed to renew their lease.
`protected void` | `init(String tableName, String domainName, String clusterName, int dbType)`

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

Field Detail

### TIME_AS_FRACTION_OF_DAY

    public static String TIME_AS_FRACTION_OF_DAY

Constructor Detail

### QueryHelper

    public QueryHelper(String tableName,
                       String domainName,
                       String clusterName,
                       int dbType)

### QueryHelper

    public QueryHelper()

Method Detail

### init

    protected void init(String tableName,
                        String domainName,
                        String clusterName,
                        int dbType)

### addToDate

    protected abstract String addToDate(String date,
                                        int seconds)

  Returns an sql snippet that adds the specifed number of seconds to the date value.

  Parameters:
    `date` - date variable to add to
    `seconds` - number of seconds to add to column
  Returns:
    an sql snippet

### compareDates

    protected abstract String compareDates(String date1,
                                           String date2)

  Returns an sql snippet that compares the two specified dates. The query should return true if date1 is later than date2.

  Parameters:
    `date1` -
    `date2` -
  Returns:
    an sql snippet

### getTimeFunction

    protected abstract String getTimeFunction()

  Returns a query that returns the current time & date, down to at least seconds precision.

  Returns:
    an sql snippet

### getDBType

    protected int getDBType()

### getLeaseOwnerQuery

    public String getLeaseOwnerQuery(String leaseName)

  Returns a query that returns the owner of the provided lease

  Parameters:
    `leaseName` - name of lease
  Returns:
    a query string

### getPreviousLeaseOwnerQuery

    public String getPreviousLeaseOwnerQuery(String leaseName)

  Returns the current/last owner of the provided lease, regardless of whether it has expired or not.

  Parameters:
    `leaseName` - name of lease
  Returns:
    a query string

### getAcquireLeaseQuery

    public String getAcquireLeaseQuery(String leaseName,
                                       String owner)

  Returns a query that tries to delete any timed-out leases associated with this name.

  Parameters:
    `leaseName` - name of lease
    `owner` - server who is the owner as a transient identity string
  Returns:
    a query string

### getAssumeLeaseQuery

    public String getAssumeLeaseQuery(String leaseName,
                                      String owner,
                                      int leaseTimeout)

  Returns a query that tries to insert a new lease into the database with the given lease name and timeout period.

  Parameters:
    `leaseName` - name of lease
    `owner` - server who is the owner as a transient identity string
    `leaseTimeout` - period after which the lease will timeout in seconds from now
  Returns:
    a query string

### getRenewLeaseQuery

    public String getRenewLeaseQuery(String leaseName,
                                     String owner,
                                     int leaseTimeout)

  Returns a query that updates the provided lease to be valid until 'timeoutPeriod' seconds pass

  Parameters:
    `leaseName` - name of lease
    `owner` - server who is the owner as a transient identity string
    `leaseTimeout` - period after which the lease will expire in seconds from now
  Returns:
    a query string

### getRenewAllLeasesQuery

    public String getRenewAllLeasesQuery(String owner,
                                         int leaseTimeout)

  Returns a query that updates all the leases in database owned by 'owner' to be valid until 'timeoutPeriod' seconds pass.

  Parameters:
    `owner` - server who is the owner of the leases as a transient identity string
    `leaseTimeout` - period after which the lease will expire in seconds from now
  Returns:
    a query string

### getAbdicateLeaseQuery

    public String getAbdicateLeaseQuery(String leaseName,
                                        String owner)

  Returns a query that removes lease from database, regardless of if it is expired or not. Only works for leases held by 'owner'.

  Parameters:
    `leaseName` - name of lease
    `owner` - server who is the owner as a transient identity string
  Returns:
    a query string

### getUnresponsiveMigratableServersQuery

    public String getUnresponsiveMigratableServersQuery(int gracePeriod)

  Returns a query that returns a list of server names that failed to renew their lease. This query is used to determine what servers should be restarted, so it includes the grace period in its calculations.

  Parameters:
    `gracePeriod` - amount of time to wait after a lease expires before the server is migrated, in seconds
  Returns:
    a query string

### getInsertMachineQuery

    public String getInsertMachineQuery(String serverName,
                                        String hostMachine,
                                        String machineTableName)

  Returns a query that associates a server with a machine in the given table

  Parameters:
    `serverName` - name of server
    `hostMachine` - name of the machine
  Returns:
    a query string

### getDeleteMachineQuery

    public String getDeleteMachineQuery(String serverName,
                                        String machineTableName)

  Returns a query that disassociates a server from a machine in the given table

  Parameters:
    `serverName` - name of server
    `machineTableName` - table to delete from
  Returns:
    a query string

### getRetrieveMachineQuery

    public String getRetrieveMachineQuery(String serverName,
                                          String machineTableName)

  Returns a query that finds the machine associated with the given server name

  Parameters:
    `serverName` - name of server
    `machineTableName` - table to perform the lookup in
  Returns:
    a query string

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