|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.slide.common.AbstractSimpleService
Slide Service simple implementation. Will allow only one simultaneous transaction context.
Field Summary | |
protected javax.transaction.xa.Xid |
currentContext
Current transaction context. |
protected Namespace |
namespace
Namespace. |
protected boolean |
rollbackOnly
Rollback only. |
protected int |
status
Status reagrding the current job. |
protected int |
transactionTimeout
Transaction timeout. |
static int |
TX_IDLE
|
static int |
TX_PREPARED
|
static int |
TX_SUSPENDED
|
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
AbstractSimpleService()
|
Method Summary | |
boolean |
cacheResults()
Indicates whether or not the objects managed by this service should be cached. |
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
Commit the global transaction specified by xid. |
abstract void |
connect()
Connects to the underlying data source (if any is needed). |
boolean |
connectIfNeeded()
Connects to the service, if we were not previously connected. |
abstract void |
disconnect()
Disconnects from the underlying data source. |
void |
end(javax.transaction.xa.Xid xid,
int flags)
Ends the work performed on behalf of a transaction branch. |
void |
forget(javax.transaction.xa.Xid xid)
Tell the resource manager to forget about a heuristically completed transaction branch. |
int |
getTransactionTimeout()
Obtain the current transaction timeout value set for this XAResource instance. |
void |
initialize(NamespaceAccessToken token)
Initializes service. |
abstract boolean |
isConnected()
This function tells whether or not the service is connected. |
boolean |
isSameRM(javax.transaction.xa.XAResource xares)
This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares. |
int |
prepare(javax.transaction.xa.Xid xid)
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid. |
javax.transaction.xa.Xid[] |
recover(int flag)
Obtain a list of prepared transaction branches from a resource manager. |
abstract void |
reset()
Deletes service underlying data source, if possible (and meaningful). |
void |
rollback(javax.transaction.xa.Xid xid)
Inform the resource manager to roll back work done on behalf of a transaction branch. |
void |
setNamespace(Namespace namespace)
Namespace setter. |
abstract void |
setParameters(java.util.Hashtable parameters)
Initializes the service with a set of parameters. |
boolean |
setTransactionTimeout(int seconds)
Set the current transaction timeout value for this XAResource instance. |
void |
start(javax.transaction.xa.Xid xid,
int flags)
Start work on behalf of a transaction branch specified in xid If TMJOIN is specified, the start is for joining a transaction previously seen by the resource manager. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int TX_IDLE
public static final int TX_PREPARED
public static final int TX_SUSPENDED
protected javax.transaction.xa.Xid currentContext
protected int status
protected Namespace namespace
protected int transactionTimeout
protected boolean rollbackOnly
Constructor Detail |
public AbstractSimpleService()
Method Detail |
public void setNamespace(Namespace namespace)
setNamespace
in interface Service
public abstract void setParameters(java.util.Hashtable parameters) throws ServiceParameterErrorException, ServiceParameterMissingException
setParameters
in interface Service
parameters
- Hashtable containing the parameters' names
and associated valuesServiceParameterErrorException
- Incorrect service parameterServiceParameterMissingException
- Service parameter missingpublic abstract void connect() throws ServiceConnectionFailedException
connect
in interface Service
ServiceConnectionFailedException
- Connection failedpublic abstract void disconnect() throws ServiceDisconnectionFailedException
disconnect
in interface Service
ServiceDisconnectionFailedException
- Disconnection failedpublic void initialize(NamespaceAccessToken token) throws ServiceInitializationFailedException
initialize
in interface Service
token
- Namespace access token, needed if the service needs to
access objects or data within the namespace during its initializationServiceInitializationFailedException
- May throw an exception
if the service has already been initialized beforepublic abstract void reset() throws ServiceResetFailedException
reset
in interface Service
ServiceResetFailedException
- Reset failedpublic abstract boolean isConnected() throws ServiceAccessException
isConnected
in interface Service
ServiceAccessException
- Service access errorpublic boolean connectIfNeeded() throws ServiceConnectionFailedException, ServiceAccessException
connectIfNeeded
in interface Service
ServiceAccessException
- Unspecified service access errorServiceConnectionFailedException
- Connection failedpublic boolean cacheResults()
cacheResults
in interface Service
public void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifieronePhase
- If true, the resource manager should use a one-phase
commit protocol to commit the work done on behalf of xid.javax.transaction.xa.XAException
- An error has occurred. Possible XAExceptions
are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO. If the resource
manager did not commit the transaction and the paramether onePhase is
set to true, the resource manager may throw one of the XA_RB*
exceptions. Upon return, the resource manager has rolled back the
branch's work and has released all held resources.public void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
end
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier that is the same as what
was used previously in the start method.flags
- One of TMSUCCESS, TMFAIL, or TMSUSPENDjavax.transaction.xa.XAException
- An error has occurred. Possible XAException
values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
XAER_PROTO, or XA_RB*.public void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurred. Possible exception values
are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public int getTransactionTimeout() throws javax.transaction.xa.XAException
getTransactionTimeout
in interface javax.transaction.xa.XAResource
javax.transaction.xa.XAException
- An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL.public boolean isSameRM(javax.transaction.xa.XAResource xares) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
xares
- An XAResource object whose resource manager instance is
to be compared with the resource manager instance of the target object.javax.transaction.xa.XAException
- An error has occurred. Possible exception values
are XAER_RMERR, XAER_RMFAIL.public int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurred. Possible exception
values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
or XAER_PROTO.public javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must
be used when no other flags are set in flags.javax.transaction.xa.XAException
- An error has occurred. Possible values are
XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.public void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifierjavax.transaction.xa.XAException
- An error has occurredpublic boolean setTransactionTimeout(int seconds) throws javax.transaction.xa.XAException
setTransactionTimeout
in interface javax.transaction.xa.XAResource
seconds
- the transaction timeout value in seconds.javax.transaction.xa.XAException
- An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.public void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier to be associated with the
resourceflags
- One of TMNOFLAGS, TMJOIN, or TMRESUMEjavax.transaction.xa.XAException
- An error has occurred. Possible exceptions are
XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA,
XAER_INVAL, or XAER_PROTO.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |