org.apache.derby.impl.store.raw.xact
Class TransactionTable.UpdateTransactionCounter

java.lang.Object
  extended by org.apache.derby.impl.store.raw.xact.TransactionTable.UpdateTransactionCounter
All Implemented Interfaces:
TransactionTable.EntryVisitor
Enclosing class:
TransactionTable

private static class TransactionTable.UpdateTransactionCounter
extends java.lang.Object
implements TransactionTable.EntryVisitor

Visitor class that counts update transactions. Note that update transactions may be added or removed concurrently unless the caller synchronizes on "this" (the TransactionTable instance) while applying the visitor.


Field Summary
private  int count
           
private  boolean stopOnFirst
           
 
Constructor Summary
TransactionTable.UpdateTransactionCounter(boolean stopOnFirst)
          Create an instance of this visitor.
 
Method Summary
(package private)  int getCount()
          Get the number of update transactions seen by this visitor
 boolean visit(TransactionTableEntry entry)
          Check if the entry represents an update transaction, and update the counter accordingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stopOnFirst

private final boolean stopOnFirst

count

private int count
Constructor Detail

TransactionTable.UpdateTransactionCounter

TransactionTable.UpdateTransactionCounter(boolean stopOnFirst)
Create an instance of this visitor.

Parameters:
stopOnFirst - if true, stop the scan as soon as we have found one update transaction (useful if all we care about is whether or not the transaction table contains an update transaction); otherwise, scan the entire transaction table
Method Detail

visit

public boolean visit(TransactionTableEntry entry)
Check if the entry represents an update transaction, and update the counter accordingly.

Specified by:
visit in interface TransactionTable.EntryVisitor
Parameters:
entry - the TransactionTableEntry being visited
Returns:
true if the scan of the transaction table should continue, or false if the visitor has completed its work and no more entries need to be visited

getCount

int getCount()
Get the number of update transactions seen by this visitor

Returns:
number of update transactions

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.