|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.kernel.AbstractAccessCoordinator
com.sun.sgs.impl.kernel.LockingAccessCoordinator
public class LockingAccessCoordinator
An implementation of AccessCoordinator that uses locking to handle
conflicts.
This implementation checks for deadlock whenever an access request is blocked due to a conflict. It selects the youngest transaction as the deadlock victim, determining the age using the originally requested start time for the task associated with the transaction. The implementation does not deny requests that would not result in deadlock. When requests block, it services the requests in the order that they arrive.
The methods that this class provides to implement AccessReporter are
not thread safe, and should either be called from a single thread or else
protected with external synchronization.
The constructor supports the following
configuration properties:
com.sun.sgs.txn.timeout property, if specified,
otherwise times the value of the default transaction timeout.
0, and should
be less than the transaction timeout.
0.
This class uses the Logger named com.sun.sgs.impl.kernel.LockingAccessCoordinator to log information at the
following logging levels:
| Nested Class Summary | |
|---|---|
static class |
LockingAccessCoordinator.LockerImpl
Define a locker that records information about the transaction requesting locks, and descriptions. |
| Nested classes/interfaces inherited from class com.sun.sgs.impl.kernel.AbstractAccessCoordinator |
|---|
AbstractAccessCoordinator.AbstractAccessReporter<T> |
| Field Summary | |
|---|---|
static double |
DEFAULT_LOCK_TIMEOUT_PROPORTION
The proportion of the transaction timeout to use for the lock timeout if no lock timeout is specified. |
static String |
LOCK_TIMEOUT_PROPERTY
The property for specifying the maximum number of milliseconds to wait for obtaining a lock. |
(package private) static LoggerWrapper |
logger
The logger for this class. |
static int |
NUM_KEY_MAPS_DEFAULT
The default number of key maps. |
static String |
NUM_KEY_MAPS_PROPERTY
The property for specifying the number of maps to use for associating keys and maps. |
| Fields inherited from class com.sun.sgs.impl.kernel.AbstractAccessCoordinator |
|---|
profileCollectorHandle, txnProxy |
| Constructor Summary | |
|---|---|
LockingAccessCoordinator(Properties properties,
TransactionProxy txnProxy,
ProfileCollectorHandle profileCollectorHandle)
Creates an instance of this class. |
|
| Method Summary | ||
|---|---|---|
Transaction |
getConflictingTransaction(Transaction txn)
Find out what transaction, if still active, caused the given transaction to fail due to conflict. |
|
(package private) LockingAccessCoordinator.LockerImpl |
getLocker(Transaction txn)
Returns the locker associated with a transaction. |
|
void |
notifyNewTransaction(Transaction txn,
long requestedStartTime,
int tryCount)
Notifies the coordinator that a new transaction is starting. |
|
|
registerAccessSource(String sourceName,
Class<T> objectIdType)
Register as a provider of shared objects, and therefore a possible source of conflict between transactions. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String LOCK_TIMEOUT_PROPERTY
public static final double DEFAULT_LOCK_TIMEOUT_PROPORTION
public static final String NUM_KEY_MAPS_PROPERTY
public static final int NUM_KEY_MAPS_DEFAULT
static final LoggerWrapper logger
| Constructor Detail |
|---|
public LockingAccessCoordinator(Properties properties,
TransactionProxy txnProxy,
ProfileCollectorHandle profileCollectorHandle)
properties - the configuration propertiestxnProxy - the transaction proxyprofileCollectorHandle - the profile collector handle
IllegalArgumentException - if the values of the configuration
properties are illegal| Method Detail |
|---|
public <T> AccessReporter<T> registerAccessSource(String sourceName,
Class<T> objectIdType)
DataService which provides access to
ManagedObjects and name bindings). This ensures that
conflict is managed for access to the reported objects, and
that a report of all accesses is available through profiling.
T - the type of the id object used to report accessessourceName - the name of the source of objects which may
cause conflict on accessobjectIdType - the type of the identifier that will be used
to identify accessed objects
AccessReporter used to notify the system
of access to shared objectspublic Transaction getConflictingTransaction(Transaction txn)
This implementation does not record information about completed
transactions, so it always returns null.
txn - a Transaction that failed due to conflict
Transaction that caused the provided
Transaction to fail due to conflict, or
null if there is no such active Transaction
public void notifyNewTransaction(Transaction txn,
long requestedStartTime,
int tryCount)
txn - the transactionrequestedStartTime - the time in milliseconds that the task
associated with the transaction was originally requested to
starttryCount - the number of times that transactions have been
attempted for the task associated with txnLockingAccessCoordinator.LockerImpl getLocker(Transaction txn)
txn - the transaction
IllegalArgumentException - if the transaction is not active
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||