com.sun.sgs.impl.kernel
Class NullAccessCoordinator

java.lang.Object
  extended by com.sun.sgs.impl.kernel.NullAccessCoordinator
All Implemented Interfaces:
AccessCoordinatorHandle, AccessCoordinator, AccessReporter<Object>

public class NullAccessCoordinator
extends Object
implements AccessCoordinatorHandle, AccessReporter<Object>

Define an AccessCoordinatorHandle that does not detect conflicts, report accesses to the profiling system, or perform any error checking on its arguments.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.sgs.kernel.AccessReporter
AccessReporter.AccessType
 
Constructor Summary
NullAccessCoordinator()
          Creates an instance of this class.
NullAccessCoordinator(Properties properties, TransactionProxy txnProxy, ProfileCollectorHandle profileCollectorHandle)
          Creates an instance of this class, accepting the standard arguments for access coordinators, which are ignored.
 
Method Summary
 Transaction getConflictingTransaction(Transaction txn)
          Find out what transaction, if still active, caused the given transaction to fail due to conflict.
 void notifyNewTransaction(Transaction txn, long requestedStartTime, int tryCount)
          Notifies the coordinator that a new transaction is starting.
<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.
 void reportObjectAccess(Object objectId, AccessReporter.AccessType type)
          Reports to the coordinator that object access has been requested in the context of the current transaction.
 void reportObjectAccess(Object objectId, AccessReporter.AccessType type, Object description)
          Reports to the coordinator that an object access with the provided description has been requested in the context of the current transaction.
 void reportObjectAccess(Transaction txn, Object objectId, AccessReporter.AccessType type)
          Reports to the coordinator that object access has been requested in the context of the provided transaction.
 void reportObjectAccess(Transaction txn, Object objectId, AccessReporter.AccessType type, Object description)
          Reports to the coordinator that an object access with the provided description has been requested in the context of the provided transaction.
 void setObjectDescription(Object objectId, Object description)
          In the current transaction, associates the given object with some description that should have a meaningful toString method.
 void setObjectDescription(Transaction txn, Object objectId, Object description)
          In the provided transaction, associates the given object with some description that should have a meaningful toString method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullAccessCoordinator

public NullAccessCoordinator()
Creates an instance of this class.


NullAccessCoordinator

public NullAccessCoordinator(Properties properties,
                             TransactionProxy txnProxy,
                             ProfileCollectorHandle profileCollectorHandle)
Creates an instance of this class, accepting the standard arguments for access coordinators, which are ignored.

Parameters:
properties - the configuration properties
txnProxy - the transaction proxy
profileCollectorHandle - the profile collector handle
Method Detail

registerAccessSource

public <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.

Specified by:
registerAccessSource in interface AccessCoordinator
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

public 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.

Specified by:
getConflictingTransaction in interface AccessCoordinator
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

notifyNewTransaction

public void notifyNewTransaction(Transaction txn,
                                 long requestedStartTime,
                                 int tryCount)
Notifies the coordinator that a new transaction is starting.

Specified by:
notifyNewTransaction in interface AccessCoordinatorHandle
Parameters:
txn - the transaction
requestedStartTime - the time in milliseconds that the task associated with the transaction was originally requested to start
tryCount - the number of times that transactions have been attempted for the task associated with txn

reportObjectAccess

public void reportObjectAccess(Object objectId,
                               AccessReporter.AccessType type)
Reports to the coordinator that object access has been requested in the context of the current transaction. The requested object is shared, and may be the cause of conflict.

Specified by:
reportObjectAccess in interface AccessReporter<Object>
Parameters:
objectId - an identifier for the object being accessed
type - the AccessType being requested

reportObjectAccess

public void reportObjectAccess(Transaction txn,
                               Object objectId,
                               AccessReporter.AccessType type)
Reports to the coordinator that object access has been requested in the context of the provided transaction. The requested object is shared, and may be the cause of conflict.

Specified by:
reportObjectAccess in interface AccessReporter<Object>
Parameters:
txn - the transaction in which the provided objId was accessed
objectId - an identifier for the object being accessed
type - the AccessType being requested

reportObjectAccess

public void reportObjectAccess(Object objectId,
                               AccessReporter.AccessType type,
                               Object description)
Reports to the coordinator that an object access with the provided description has been requested in the context of the current transaction. The requested object is shared, and may be the cause of conflict. See setObjectDescription for more details about description.

Specified by:
reportObjectAccess in interface AccessReporter<Object>
Parameters:
objectId - an identifier for the object being accessed
type - the AccessType being requested
description - an arbitrary object that contains a description of the object being accessed

reportObjectAccess

public void reportObjectAccess(Transaction txn,
                               Object objectId,
                               AccessReporter.AccessType type,
                               Object description)
Reports to the coordinator that an object access with the provided description has been requested in the context of the provided transaction. The requested object is shared, and may be the cause of conflict. See setObjectDescription for more details about description.

Specified by:
reportObjectAccess in interface AccessReporter<Object>
Parameters:
txn - the transaction in which the provided objId was accessed
objectId - an identifier for the object being accessed
type - the AccessType being requested
description - an arbitrary object that contains a description of the object being accessed

setObjectDescription

public void setObjectDescription(Object objectId,
                                 Object description)
In the current transaction, associates the given object with some description that should have a meaningful toString method. This description will be available in the profiling data, and is useful when displaying details about a given accessed object. The intent is that an arbitrary description can be included with an object, but that the description is not accessed unless a ProfileListener finds it useful to do so. At that point the description's toString method may be called, or the object itself might be cast to some known type to extract more detail about the accessed object.

Note that this may be called before the associated object is actually accessed, and therefore before reportObjectAccess is called for the given objId. Use of this method is optional, and only used to provide additional detail for profiling and debugging.

If a description has already been set for the identified object, or if the provided description is null, then no change is made to the description of the object.

Specified by:
setObjectDescription in interface AccessReporter<Object>
Parameters:
objectId - the identifier for the associated object
description - an arbitrary Object that contains a description of the objId being accessed

setObjectDescription

public void setObjectDescription(Transaction txn,
                                 Object objectId,
                                 Object description)
In the provided transaction, associates the given object with some description that should have a meaningful toString method. This description will be available in the profiling data, and is useful when displaying details about a given accessed object. The intent is that an arbitrary description can be included with an object, but that the description is not accessed unless a ProfileListener finds it useful to do so. At that point the description's toString method may be called, or the object itself might be cast to some known type to extract more detail about the accessed object.

Note that this may be called before the associated object is actually accessed, and therefore before reportObjectAccess is called for the given objId. Use of this method is optional, and only used to provide additional detail for profiling and debugging.

If a description has already been set for the identified object, or if the provided description is null, then no change is made to the description of the object.

Specified by:
setObjectDescription in interface AccessReporter<Object>
Parameters:
txn - the transaction in which the provided objId was accessed
objectId - the identifier for the associated object
description - an arbitrary Object that contains a description of the objId being accessed

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