org.objectweb.cjdbc.controller.recoverylog
Class JDBCLoggerThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.objectweb.cjdbc.controller.recoverylog.JDBCLoggerThread
All Implemented Interfaces:
java.lang.Runnable

public class JDBCLoggerThread
extends java.lang.Thread

Logger thread for the JDBCRecoveryLog.

Version:
1.0
Author:
Emmanuel Cecchet

Nested Class Summary
private  class JDBCLoggerThread.LogObject
           
 
Field Summary
private  boolean killed
           
private  Trace logger
           
private  java.util.ArrayList logQueue
           
private  java.sql.PreparedStatement pstmt
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JDBCLoggerThread(java.sql.PreparedStatement pstmt, Trace logger)
          Create a new JDBCLoggerThread
 
Method Summary
 boolean getLogQueueIsEmpty()
          Tells whether there are pending logs
 void log(long id, java.lang.String login, java.lang.String query, long tid, boolean escapeProcessing)
          Log a query.
 void removeQueriesOfTransactionFromQueue(long tid)
          Remove all queries that have not been logged yet and belonging to the specified transaction.
 void rollbackTransactions()
          Roll back all unfinished transactions.
 void run()
          Log the requests from queue until the thread is explicetly killed.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

killed

private boolean killed

logQueue

private java.util.ArrayList logQueue

pstmt

private java.sql.PreparedStatement pstmt

logger

private Trace logger
Constructor Detail

JDBCLoggerThread

public JDBCLoggerThread(java.sql.PreparedStatement pstmt,
                        Trace logger)
Create a new JDBCLoggerThread

Parameters:
pstmt - the PreparedStatement to use to log the requests
logger - where to log error messages
Method Detail

log

public void log(long id,
                java.lang.String login,
                java.lang.String query,
                long tid,
                boolean escapeProcessing)
Log a query.

Parameters:
id - unique request id
login - login used for this request
query - query to log
tid - transaction id of this request
escapeProcessing - true if escape processing must be done

rollbackTransactions

public void rollbackTransactions()
Roll back all unfinished transactions.


removeQueriesOfTransactionFromQueue

public void removeQueriesOfTransactionFromQueue(long tid)
Remove all queries that have not been logged yet and belonging to the specified transaction.

Parameters:
tid - transaction id to rollback

getLogQueueIsEmpty

public boolean getLogQueueIsEmpty()
Tells whether there are pending logs

Returns:
true if no more jobs in the log queue

run

public void run()
Log the requests from queue until the thread is explicetly killed. The logger used is the one of the JDBCRecoveryLog.



Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.