Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.tools.jdbc
Class ConnectionManager

    java.lang.Object
      |
      +--org.w3c.tools.jdbc.ConnectionManager

public class ConnectionManager
extends java.lang.Object
implements PropertyMonitoring

Field Summary
`protected java.util.Comparator` | `conn_comparator`
`protected int` | `conn_count`
`protected int` | `conn_max`
`protected int` | `conn2free`
`protected LRUList` | `connectionsLru` The LRU list of idle connections.
`static boolean` | `debug`
`protected int` | `state`
`static int` | `STATE_CHANGED`
`static int` | `STATE_UNCHANGED`
`protected java.util.LinkedList` | `usedConnections` The LRU list of used connection
`static long` | `WAIT_TIMEOUT`

Method Summary
`protected JdbcConnection` | `allocateConnection(JdbcServer server)` Connections management - Allocate a new connection for this server.
`protected void` | `deleteConnection(JdbcConnection conn)`
`protected void` | `freeConnections()` PANIC, we need to close some used connection.
`protected JdbcConnection` | `getConnection(JdbcServer server)` Get a connection to the given server.
`static ConnectionManager` | `getManager()`
`static ConnectionManager` | `getManager(java.util.Properties p)` Get an instance of the Jdbc manager.
`protected boolean` | `negotiateConnection(JdbcServer server)`
`protected void` | `notifyConnection(JdbcConnection conn)` A new connection has just been created.
`void` | `notifyIdle(JdbcConnection conn)` The given connection can be reused, but is now idle.
`void` | `notifyUse(JdbcConnection conn)` The given connection is about to be used.
`boolean` | `propertyChanged(java.lang.String name)` PropertyMonitoring implementation.
`protected void` | `waitForConnection(JdbcServer server)` Wait for a connection to come up.

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

Field Detail

### WAIT_TIMEOUT

    public static final long WAIT_TIMEOUT

### debug

    public static final boolean debug

### STATE_UNCHANGED

    public static final int STATE_UNCHANGED

### STATE_CHANGED

    public static final int STATE_CHANGED

### state

    protected int state

### conn_count

    protected int conn_count

### conn_max

    protected int conn_max

### conn2free

    protected int conn2free

### connectionsLru

    protected LRUList connectionsLru

  The LRU list of idle connections.

### usedConnections

    protected java.util.LinkedList usedConnections

  The LRU list of used connection

### conn_comparator

    protected java.util.Comparator conn_comparator

Method Detail

### propertyChanged

    public boolean propertyChanged(java.lang.String name)

  PropertyMonitoring implementation.
  Specified by:
    propertyChanged in interface PropertyMonitoring
  Tags copied from interface: PropertyMonitoring
  Parameters:
    `name` - The name of the property that changed.
  Returns:
    A boolean, if true, accept the new property value, otherwise, reject it and reset the property to its old value.

### getConnection

    protected JdbcConnection getConnection(JdbcServer server)

  Get a connection to the given server.
  Parameters:
    `server` - the jdbc server.
  Returns:
    a JdbcConnection or null if there is no connection available.

### freeConnections

    protected void freeConnections()

  PANIC, we need to close some used connection.

### allocateConnection

    protected JdbcConnection allocateConnection(JdbcServer server)

  Connections management - Allocate a new connection for this server.
  Parameters:
    `server` - the JdbcServer
  Returns:
    a newly created connection or null

### negotiateConnection

    protected boolean negotiateConnection(JdbcServer server)

### deleteConnection

    protected void deleteConnection(JdbcConnection conn)

### notifyConnection

    protected void notifyConnection(JdbcConnection conn)

  A new connection has just been created.
  Parameters:
    `conn` - the new connection

### notifyUse

    public void notifyUse(JdbcConnection conn)

  The given connection is about to be used. Update our list of available servers.
  Parameters:
    `conn` - The idle connection.

### notifyIdle

    public void notifyIdle(JdbcConnection conn)

  The given connection can be reused, but is now idle.
  Parameters:
    `conn` - The connection that is now idle.

### waitForConnection

    protected void waitForConnection(JdbcServer server)
                              throws java.lang.InterruptedException

  Wait for a connection to come up.
  Parameters:
    `server,` - the target server.
  Throws:
    java.lang.InterruptedException - If interrupted..

### getManager

    public static ConnectionManager getManager(java.util.Properties p)

  Get an instance of the Jdbc manager. This method returns an actual instance of the Jdbc manager. It may return different managers, if it decides to distribute the load on different managers (avoid the ConnectionManager being a bottleneck).
  Returns:
    An application wide instance of the Jdbc manager.

### getManager

    public static ConnectionManager getManager()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD