com.sun.jini.outrigger
Class TxnMonitor

java.lang.Object
  extended by com.sun.jini.outrigger.TxnMonitor
All Implemented Interfaces:
Runnable

 class TxnMonitor
extends Object
implements Runnable

This class provides a driver for monitoring the state of transactions that have blocked progress of other operations recently. It creates tasks that monitor each transaction by intermittently querying the transaction's state. If it finds that the transaction has aborted, it makes sure that the local space aborts the transaction, too, so that operations will cease to be blocked by the transaction.

Author:
Sun Microsystems, Inc.
See Also:
TxnMonitorTask, OutriggerServerImpl.monitor(com.sun.jini.outrigger.QueryWatcher, java.util.Collection)

Nested Class Summary
private static class TxnMonitor.ToMonitor
          Each ToMonitor object represents a need to monitor the given transactions, possibly under a lease.
 
Field Summary
private  boolean die
          Set when we are told to stop
private static Logger logger
          Logger for logging transaction related information
private  Thread ourThread
          The thread running us.
private  LinkedList pending
          This list is used to contain requests to monitor interfering transactions.
private  OutriggerServerImpl space
          The space we belong to.
private  TaskManager taskManager
          The manager for TxnMonitorTask objects.
private  WakeupManager wakeupMgr
          wakeup manager for TxnMonitorTasks
 
Constructor Summary
TxnMonitor(OutriggerServerImpl space, Configuration config)
          Create a new TxnMonitor.
 
Method Summary
(package private)  void add(Collection transactions)
          Add a set of transactions to be monitored under no lease.
(package private)  void add(QueryWatcher query, Collection transactions)
          Add a set of transactions to be monitored under the given query.
 void destroy()
           
 void run()
          Take pending monitor requests off the queue, creating the required TxnMonitorTask objects and scheduling them.
(package private)  OutriggerServerImpl space()
          Return the space we're part of.
private  TxnMonitorTask taskFor(Txn txn)
          Return the monitor task for this transaction, creating it if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pending

private LinkedList pending
This list is used to contain requests to monitor interfering transactions. We use a list like this so that the getMatch request that detected the conflict doesn't have to wait for all the setup before returning -- it just puts the data on this list and the TxnMonitor pulls it off using its own thread.

See Also:
OutriggerServerImpl.getMatch(com.sun.jini.outrigger.EntryRep, net.jini.core.transaction.Transaction, long, boolean, boolean, com.sun.jini.outrigger.OutriggerServer.QueryCookie)

wakeupMgr

private final WakeupManager wakeupMgr
wakeup manager for TxnMonitorTasks


taskManager

private TaskManager taskManager
The manager for TxnMonitorTask objects.


space

private OutriggerServerImpl space
The space we belong to. Needed for aborts.


ourThread

private Thread ourThread
The thread running us.


die

private boolean die
Set when we are told to stop


logger

private static final Logger logger
Logger for logging transaction related information

Constructor Detail

TxnMonitor

TxnMonitor(OutriggerServerImpl space,
           Configuration config)
     throws ConfigurationException
Create a new TxnMonitor.

Throws:
ConfigurationException
Method Detail

destroy

public void destroy()

space

OutriggerServerImpl space()
Return the space we're part of.


add

void add(QueryWatcher query,
         Collection transactions)
Add a set of transactions to be monitored under the given query.


add

void add(Collection transactions)
Add a set of transactions to be monitored under no lease.


run

public void run()
Take pending monitor requests off the queue, creating the required TxnMonitorTask objects and scheduling them.

Specified by:
run in interface Runnable

taskFor

private TxnMonitorTask taskFor(Txn txn)
Return the monitor task for this transaction, creating it if necessary.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.