com.sun.sgs.impl.kernel
Class TransactionProxyImpl

java.lang.Object
  extended by com.sun.sgs.impl.kernel.TransactionProxyImpl
All Implemented Interfaces:
TransactionProxy

final class TransactionProxyImpl
extends Object
implements TransactionProxy

This is a proxy that provides access to the currently active Transaction and its owner. Because Services are the only components outside of the kernel that should have visibility into this state, they are the only components in the system that are provided a reference to the usable proxy.


Constructor Summary
TransactionProxyImpl()
          This package-private constructor creates a new instance of TransactionProxyImpl.
 
Method Summary
 Identity getCurrentOwner()
          Returns the owner of the task that is executing the current transaction.
 Transaction getCurrentTransaction()
          Returns the current transaction state.
<T extends Service>
T
getService(Class<T> type)
          Returns a Service, based on the given type, that is available in the context of the current Transaction.
 boolean inTransaction()
          Returns true if there is a current transaction, even if the transaction has been aborted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionProxyImpl

TransactionProxyImpl()
This package-private constructor creates a new instance of TransactionProxyImpl. It is package-private so that only the kernel components can create instances for access to the current Transaction.

Method Detail

getCurrentTransaction

public Transaction getCurrentTransaction()
Returns the current transaction state.

Specified by:
getCurrentTransaction in interface TransactionProxy
Returns:
the current Transaction

inTransaction

public boolean inTransaction()
Returns true if there is a current transaction, even if the transaction has been aborted.

Specified by:
inTransaction in interface TransactionProxy
Returns:
true if there is a current transaction

getCurrentOwner

public Identity getCurrentOwner()
Returns the owner of the task that is executing the current transaction.

Specified by:
getCurrentOwner in interface TransactionProxy
Returns:
the current transaction owner's Identity

getService

public <T extends Service> T getService(Class<T> type)
Returns a Service, based on the given type, that is available in the context of the current Transaction. If the type is unknown, or if there is more than one Service of the given type, MissingResourceException is thrown.

Specified by:
getService in interface TransactionProxy
Type Parameters:
T - the type of the Service
Parameters:
type - the Class of the requested Service
Returns:
the requested Service

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