com.sun.sgs.kernel
Interface AccessCoordinator

All Known Subinterfaces:
AccessCoordinatorHandle
All Known Implementing Classes:
AbstractAccessCoordinator, LockingAccessCoordinator, NullAccessCoordinator, TrackingAccessCoordinator

public interface AccessCoordinator

A central point for tracking all shared objects accessed in the context of a transaction, and managing any conflict these accesses may cause. In this case, "shared object" means any object that is accessible within any transaction on any node. An example would be a ManagedObject as provided by the DataService.

Each sourceName determines a unique namespace of objects. Any AccessReporter registered with the same sourceName through a given AccessCoordinator instance, independent of the objectIdType, is considered to report accesses to the same set of shared objects. Conflicting accesses to a single object can be reported to different AccessReporters if those reporters were obtained from the same access coordinator using the same source name. Object accesses reported to AccessReporters obtained from registering access sources with different names will never conflict.


Method Summary
 Transaction getConflictingTransaction(Transaction txn)
          Find out what transaction, if still active, caused the given transaction to fail due to conflict.
<T> AccessReporter<T>
registerAccessSource(String sourceName, Class<T> objectIdType)
          Register as a provider of shared objects, and therefore a possible source of conflict between transactions.
 

Method Detail

registerAccessSource

<T> AccessReporter<T> registerAccessSource(String sourceName,
                                           Class<T> objectIdType)
Register as a provider of shared objects, and therefore a possible source of conflict between transactions. This should be used by any component that is providing access to shared objects (e.g., the 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.

Type Parameters:
T - the type of the id object used to report accesses
Parameters:
sourceName - the name of the source of objects which may cause conflict on access
objectIdType - the type of the identifier that will be used to identify accessed objects
Returns:
an AccessReporter used to notify the system of access to shared objects

getConflictingTransaction

Transaction getConflictingTransaction(Transaction txn)
Find out what transaction, if still active, caused the given transaction to fail due to conflict. This is particularly useful if you want to wait for that active transaction to finish, e.g. for re-trying the failed transaction.

Parameters:
txn - a Transaction that failed due to conflict
Returns:
the active Transaction that caused the provided Transaction to fail due to conflict, or null if there is no such active Transaction

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved