QJCC homepage

biz.chitec.quarterback.util
Class DBWakeupToggler

java.lang.Object
  extended bybiz.chitec.quarterback.util.DBWakeupToggler

public final class DBWakeupToggler
extends java.lang.Object

Sends from time to time request to database connections to prevent them from being closed. Used by its statis methods attach() and remove(). Keeps some Threads internally but generally takes great care not to use too much resources.

Version:
$Id: 5416a076a670f30099c9c515254923783e392dbc $
Author:
Dirk Hillbrecht 1997-1999, chitec/Dirk Hillbrecht 2000,2002. Distributed under the terms of the GNU LGPL.

Nested Class Summary
private static class DBWakeupToggler.ListContent
          Content of the internal connection list.
 
Field Summary
private  java.util.List connections
           
private static java.util.Map conntotoggler
           
private static int counter
           
static long DEFAULTIDLETIME
          Default idle time is seven hours, which is exactly one hour less than MySQL's close time
static java.lang.String DEFAULTQUERY
          This useless query works for MySQL.
private  java.lang.Thread handleThread
           
private  java.util.List newconnections
           
private  long nextruntime
           
private  java.util.List removeconnections
           
private  long sleeprest
           
private  long sleeptime
           
private static java.util.Map togglers
           
 
Constructor Summary
private DBWakeupToggler()
           
private DBWakeupToggler(long idletimex)
           
 
Method Summary
static void attach(java.sql.Connection conn)
          Attach a connection to the wakeup toggler.
static void attach(java.sql.Connection conn, long idletime)
          Attach a connection to the wakeup toggler.
static void attach(java.sql.Connection conn, long idletime, java.lang.String querystringx, java.lang.String name)
          Attach a connection to the wakeup toggler.
private  void attach(java.sql.Connection conn, java.lang.String querystringx, java.lang.String name)
           
private  void doRemove(java.sql.Connection conn)
           
static void remove(java.sql.Connection conn)
          Remove a connection from the wakeup toggler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTIDLETIME

public static final long DEFAULTIDLETIME
Default idle time is seven hours, which is exactly one hour less than MySQL's close time

See Also:
Constant Field Values

DEFAULTQUERY

public static final java.lang.String DEFAULTQUERY
This useless query works for MySQL.

See Also:
Constant Field Values

handleThread

private java.lang.Thread handleThread

sleeptime

private long sleeptime

sleeprest

private long sleeprest

nextruntime

private long nextruntime

connections

private java.util.List connections

newconnections

private java.util.List newconnections

removeconnections

private java.util.List removeconnections

togglers

private static java.util.Map togglers

conntotoggler

private static java.util.Map conntotoggler

counter

private static int counter
Constructor Detail

DBWakeupToggler

private DBWakeupToggler(long idletimex)

DBWakeupToggler

private DBWakeupToggler()
Method Detail

attach

private void attach(java.sql.Connection conn,
                    java.lang.String querystringx,
                    java.lang.String name)

doRemove

private void doRemove(java.sql.Connection conn)

attach

public static void attach(java.sql.Connection conn,
                          long idletime,
                          java.lang.String querystringx,
                          java.lang.String name)
Attach a connection to the wakeup toggler.


attach

public static void attach(java.sql.Connection conn,
                          long idletime)
Attach a connection to the wakeup toggler.


attach

public static void attach(java.sql.Connection conn)
Attach a connection to the wakeup toggler.


remove

public static void remove(java.sql.Connection conn)
Remove a connection from the wakeup toggler.


QJCC homepage