atg.commerce.util
Class TransactionLockService

java.lang.Object
  extended by atg.commerce.util.TransactionLockService
All Implemented Interfaces:
ApplicationLogging

public class TransactionLockService
extends java.lang.Object
implements ApplicationLogging

This class is used to acquire and release locks that are used before and after creating new transactions. This class shouldn't be instantiated directly, but rather created using the TransactionLockFactory

See Also:
TransactionLockFactory

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
TransactionLockService()
          Create a new empty lock service.
TransactionLockService(ClientLockManager pLockManager, java.lang.String pLockName, ApplicationLogging pLogger)
          Create a new lock service that uses the default key and provides no logging
 
Method Summary
 void acquireTransactionLock()
          Acquire a lock named lockName from clientLockManager
 void acquireTransactionLock(java.lang.String pLockName)
          Acquire a lock with the given name from clientLockManager
 ClientLockManager getClientLockManager()
          The ClientLockManager that actually provides the locks
 java.lang.String getLockName()
          The name of the lock being used
 ApplicationLogging getLogger()
          Logger to use if logging messages
 boolean isEnabled()
          If this is false, then acquireTransactionLock and releaseTransactionLock are both no-ops
 boolean isLoggingDebug()
          This method returns whether or not an debug log event should be broadcast.
 boolean isLoggingError()
          This method returns whether or not an error log event should be broadcast.
 boolean isLoggingInfo()
          This method returns whether or not an info log event should be broadcast.
 boolean isLoggingWarning()
          This method returns whether or not an warning log event should be broadcast.
 void logDebug(java.lang.String pMessage)
          Logs an debug event with the specified message
 void logDebug(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an debug event with the specified message and Throwable
 void logDebug(java.lang.Throwable pThrowable)
          Logs an debug event with the specified Throwable
 void logError(java.lang.String pMessage)
          Logs an error event with the specified message
 void logError(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an error event with the specified message and Throwable
 void logError(java.lang.Throwable pThrowable)
          Logs an error event with the specified Throwable
 void logInfo(java.lang.String pMessage)
          Logs an info event with the specified message
 void logInfo(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an info event with the specified message and Throwable
 void logInfo(java.lang.Throwable pThrowable)
          Logs an info event with the specified Throwable
 void logWarning(java.lang.String pMessage)
          Logs an warning event with the specified message
 void logWarning(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an warning event with the specified message and Throwable
 void logWarning(java.lang.Throwable pThrowable)
          Logs an warning event with the specified Throwable
 void releaseTransactionLock()
          Release the lock named lockName from clientLockManager
 void releaseTransactionLock(java.lang.String pLockName)
          Release the lock with the given name from clientLockManager
 void setClientLockManager(ClientLockManager pClientLockManager)
           
 void setEnabled(boolean pEnabled)
           
 void setLockName(java.lang.String pLockName)
           
 void setLogger(ApplicationLogging pLogger)
           
 void setLoggingDebug(boolean pLogging)
          Sets whether or not error log events should be logged.
 void setLoggingError(boolean pLogging)
          Sets whether or not error log events should be logged.
 void setLoggingInfo(boolean pLogging)
          Sets whether or not info log events should be logged.
 void setLoggingWarning(boolean pLogging)
          Sets whether or not warning log events should be logged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

TransactionLockService

public TransactionLockService()
Create a new empty lock service. Before it can be used, the clientLockManager and the lockName must be set.


TransactionLockService

public TransactionLockService(ClientLockManager pLockManager,
                              java.lang.String pLockName,
                              ApplicationLogging pLogger)
Create a new lock service that uses the default key and provides no logging

Parameters:
pLockManager - The lock manager that locks are obtained from
pLockName - The name of the lock to get from pLockManager
pLogger - This is used to log any messages during acquisition and release of locks
Method Detail

setEnabled

public void setEnabled(boolean pEnabled)

isEnabled

public boolean isEnabled()
If this is false, then acquireTransactionLock and releaseTransactionLock are both no-ops


setClientLockManager

public void setClientLockManager(ClientLockManager pClientLockManager)

getClientLockManager

public ClientLockManager getClientLockManager()
The ClientLockManager that actually provides the locks


setLockName

public void setLockName(java.lang.String pLockName)

getLockName

public java.lang.String getLockName()
The name of the lock being used


setLogger

public void setLogger(ApplicationLogging pLogger)

getLogger

public ApplicationLogging getLogger()
Logger to use if logging messages


acquireTransactionLock

public void acquireTransactionLock()
                            throws DeadlockException,
                                   atg.commerce.util.NoLockNameException
Acquire a lock named lockName from clientLockManager

Throws:
DeadlockException
atg.commerce.util.NoLockNameException

acquireTransactionLock

public void acquireTransactionLock(java.lang.String pLockName)
                            throws DeadlockException,
                                   atg.commerce.util.NoLockNameException
Acquire a lock with the given name from clientLockManager

Throws:
DeadlockException
atg.commerce.util.NoLockNameException

releaseTransactionLock

public void releaseTransactionLock()
                            throws LockManagerException
Release the lock named lockName from clientLockManager

Throws:
LockManagerException

releaseTransactionLock

public void releaseTransactionLock(java.lang.String pLockName)
                            throws LockManagerException
Release the lock with the given name from clientLockManager

Throws:
LockManagerException

isLoggingInfo

public boolean isLoggingInfo()
Description copied from interface: ApplicationLogging
This method returns whether or not an info log event should be broadcast.

Specified by:
isLoggingInfo in interface ApplicationLogging
Returns:
boolean true if info log events should be logged
false if info log events should not be logged
See Also:
ApplicationLogging.isLoggingInfo()

setLoggingInfo

public void setLoggingInfo(boolean pLogging)
Description copied from interface: ApplicationLogging
Sets whether or not info log events should be logged.

Specified by:
setLoggingInfo in interface ApplicationLogging
See Also:
ApplicationLogging.setLoggingInfo(boolean)

isLoggingWarning

public boolean isLoggingWarning()
Description copied from interface: ApplicationLogging
This method returns whether or not an warning log event should be broadcast.

Specified by:
isLoggingWarning in interface ApplicationLogging
Returns:
boolean true if warning log events should be logged
false if warning log events should not be logged
See Also:
ApplicationLogging.isLoggingWarning()

setLoggingWarning

public void setLoggingWarning(boolean pLogging)
Description copied from interface: ApplicationLogging
Sets whether or not warning log events should be logged.

Specified by:
setLoggingWarning in interface ApplicationLogging
See Also:
ApplicationLogging.setLoggingWarning(boolean)

isLoggingError

public boolean isLoggingError()
Description copied from interface: ApplicationLogging
This method returns whether or not an error log event should be broadcast.

Specified by:
isLoggingError in interface ApplicationLogging
Returns:
boolean true if error log events should be logged
false if error log events should not be logged
See Also:
ApplicationLogging.isLoggingError()

setLoggingError

public void setLoggingError(boolean pLogging)
Description copied from interface: ApplicationLogging
Sets whether or not error log events should be logged.

Specified by:
setLoggingError in interface ApplicationLogging
See Also:
ApplicationLogging.setLoggingError(boolean)

isLoggingDebug

public boolean isLoggingDebug()
Description copied from interface: ApplicationLogging
This method returns whether or not an debug log event should be broadcast.

Specified by:
isLoggingDebug in interface ApplicationLogging
Returns:
boolean true if debug log events should be logged
false if debug log events should not be logged
See Also:
ApplicationLogging.isLoggingDebug()

setLoggingDebug

public void setLoggingDebug(boolean pLogging)
Description copied from interface: ApplicationLogging
Sets whether or not error log events should be logged.

Specified by:
setLoggingDebug in interface ApplicationLogging
See Also:
ApplicationLogging.setLoggingDebug(boolean)

logInfo

public void logInfo(java.lang.String pMessage)
Description copied from interface: ApplicationLogging
Logs an info event with the specified message

Specified by:
logInfo in interface ApplicationLogging
See Also:
ApplicationLogging.logInfo(java.lang.String)

logInfo

public void logInfo(java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an info event with the specified Throwable

Specified by:
logInfo in interface ApplicationLogging
See Also:
ApplicationLogging.logInfo(java.lang.Throwable)

logInfo

public void logInfo(java.lang.String pMessage,
                    java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an info event with the specified message and Throwable

Specified by:
logInfo in interface ApplicationLogging
See Also:
ApplicationLogging.logInfo(java.lang.String, java.lang.Throwable)

logWarning

public void logWarning(java.lang.String pMessage)
Description copied from interface: ApplicationLogging
Logs an warning event with the specified message

Specified by:
logWarning in interface ApplicationLogging
See Also:
ApplicationLogging.logWarning(java.lang.String)

logWarning

public void logWarning(java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an warning event with the specified Throwable

Specified by:
logWarning in interface ApplicationLogging
See Also:
ApplicationLogging.logWarning(java.lang.Throwable)

logWarning

public void logWarning(java.lang.String pMessage,
                       java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an warning event with the specified message and Throwable

Specified by:
logWarning in interface ApplicationLogging
See Also:
ApplicationLogging.logWarning(java.lang.String, java.lang.Throwable)

logError

public void logError(java.lang.String pMessage)
Description copied from interface: ApplicationLogging
Logs an error event with the specified message

Specified by:
logError in interface ApplicationLogging
See Also:
ApplicationLogging.logError(java.lang.String)

logError

public void logError(java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an error event with the specified Throwable

Specified by:
logError in interface ApplicationLogging
See Also:
ApplicationLogging.logError(java.lang.Throwable)

logError

public void logError(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an error event with the specified message and Throwable

Specified by:
logError in interface ApplicationLogging
See Also:
ApplicationLogging.logError(java.lang.String, java.lang.Throwable)

logDebug

public void logDebug(java.lang.String pMessage)
Description copied from interface: ApplicationLogging
Logs an debug event with the specified message

Specified by:
logDebug in interface ApplicationLogging
See Also:
ApplicationLogging.logDebug(java.lang.String)

logDebug

public void logDebug(java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an debug event with the specified Throwable

Specified by:
logDebug in interface ApplicationLogging
See Also:
ApplicationLogging.logDebug(java.lang.Throwable)

logDebug

public void logDebug(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Description copied from interface: ApplicationLogging
Logs an debug event with the specified message and Throwable

Specified by:
logDebug in interface ApplicationLogging
See Also:
ApplicationLogging.logDebug(java.lang.String, java.lang.Throwable)