com.sun.sgs.impl.kernel
Class LockingAccessCoordinator.LockerImpl

java.lang.Object
  extended by com.sun.sgs.impl.util.lock.Locker<K>
      extended by com.sun.sgs.impl.util.lock.BasicLocker<K>
          extended by com.sun.sgs.impl.util.lock.TxnLocker<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key>
              extended by com.sun.sgs.impl.kernel.LockingAccessCoordinator.LockerImpl
All Implemented Interfaces:
AccessedObjectsDetail
Enclosing class:
LockingAccessCoordinator

public static class LockingAccessCoordinator.LockerImpl
extends TxnLocker<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key>
implements AccessedObjectsDetail

Define a locker that records information about the transaction requesting locks, and descriptions.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.sgs.profile.AccessedObjectsDetail
AccessedObjectsDetail.ConflictType
 
Field Summary
 
Fields inherited from class com.sun.sgs.impl.util.lock.TxnLocker
requestedStartTime, txn
 
Constructor Summary
LockingAccessCoordinator.LockerImpl(TxnLockManager<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> lockManager, Transaction txn, long requestedStartTime)
          Creates an instance of this class.
 
Method Summary
 List<AccessedObject> getAccessedObjects()
          The collection of requested object accesses.
 byte[] getConflictingId()
          Returns the identifier of the transaction that caused this access to fail, if any and if known.
 AccessedObjectsDetail.ConflictType getConflictType()
          The type of conflict, if any, caused by these object accesses.
(package private)  Object getDescription(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key)
          Gets the description associated with a key for this locker.
protected  LockRequest<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> newLockRequest(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key, boolean forWrite, boolean upgrade)
          Creates a new lock request.
(package private)  void releaseAll()
          Release all locks.
(package private)  void setConflictIfNeeded(LockConflict<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> conflict)
          Sets the specified conflict if this locker does not have a conflict set.
(package private)  void setDescription(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key, Object description)
          Sets the description associated with a key for this locker.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class com.sun.sgs.impl.util.lock.TxnLocker
clearConflict, getConflict, getLockTimeoutTime, getRequestedStartTime, getTransaction, setConflict
 
Methods inherited from class com.sun.sgs.impl.util.lock.Locker
getLockManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LockingAccessCoordinator.LockerImpl

LockingAccessCoordinator.LockerImpl(TxnLockManager<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> lockManager,
                                    Transaction txn,
                                    long requestedStartTime)
Creates an instance of this class.

Parameters:
lockManager - the lock manager for this locker
txn - the associated transaction
requestedStartTime - the time milliseconds that the task associated with the transaction was originally requested to start
Throws:
IllegalArgumentException - if requestedStartTime is less than 0
Method Detail

newLockRequest

protected LockRequest<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> newLockRequest(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key,
                                                                                           boolean forWrite,
                                                                                           boolean upgrade)
Creates a new lock request.

The default implementation creates and returns an instance of LockRequest.

This implementation records the new request and uses a local class.

Overrides:
newLockRequest in class Locker<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key>
Parameters:
key - the key that identifies the lock
forWrite - whether the request is for write
upgrade - whether the request is for an upgrade
Returns:
the lock request

releaseAll

void releaseAll()
Release all locks.


toString

public String toString()
Returns a string representation of this object. This implementation prints the associated transaction, for debugging.

Overrides:
toString in class Object
Returns:
a string representation of this object

getAccessedObjects

public List<AccessedObject> getAccessedObjects()
The collection of requested object accesses. The order is the same as the order in which the objects were requested in the transaction.

Specified by:
getAccessedObjects in interface AccessedObjectsDetail
Returns:
a List of AccessedObjects

getConflictType

public AccessedObjectsDetail.ConflictType getConflictType()
The type of conflict, if any, caused by these object accesses.

Specified by:
getConflictType in interface AccessedObjectsDetail
Returns:
the ConflictType

getConflictingId

public byte[] getConflictingId()
Returns the identifier of the transaction that caused this access to fail, if any and if known.

Specified by:
getConflictingId in interface AccessedObjectsDetail
Returns:
identifier for the successful transaction that caused conflict, or null if there was no conflict or the accessor is unknown

setDescription

void setDescription(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key,
                    Object description)
Sets the description associated with a key for this locker. The description should not be null. Does not replace an existing description.

Parameters:
key - the key
description - the description

getDescription

Object getDescription(com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key key)
Gets the description associated with a key for this locker.

Parameters:
key - the key
Returns:
the description or null

setConflictIfNeeded

void setConflictIfNeeded(LockConflict<com.sun.sgs.impl.kernel.LockingAccessCoordinator.Key> conflict)
Sets the specified conflict if this locker does not have a conflict set.


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