Top Description Inners Fields Constructors Methods
net.sf.ehcache.transaction.xa.processor

public Class XARequestProcessor

extends Object
Class Inheritance
Imports
net.sf.ehcache.transaction.xa.EhcacheXAException, .EhcacheXAResourceImpl, javax.transaction.xa.XAException, .XAResource, .Xid, java.util.concurrent.Callable, .ConcurrentHashMap, .ConcurrentMap, .ExecutionException

Default implementation for XARequestProcessor. This class ties an Xid to an Executor service. This is necessary so that locking for 2pc by the same thread. xaRequestProcessor.
Author
Nabib El-Rahman

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<Xid, XAThreadPool.MultiRunner>
private final EhcacheXAResourceImpl
private static volatile XAThreadPool

Constructor Summary

AccessConstructor and Description
public
XARequestProcessor(EhcacheXAResourceImpl
The EhcacheXAResourceImpl instance this processor will perform against
resourceImpl
)

Constructor

Method Summary

Modifier and TypeMethod and Description
private void
cleanupThread(Xid
The Xid of the Transaction
xid
)

Removes the ExecutorService from the map and shuts it down

private XAThreadPool.MultiRunner

Returns:

the ExecutorService for that Transaction
getOrCreateThread
(Xid
The Xid of the Transaction
xid
)

Gets the executor service for a Transaction, either by creating a new one if none exists, or returning the existing one

public int

Returns:

the XAResource response code
process
(XARequest
the XARequest
request
)

Process a XARequest

public static void
shutdown()

Release resources shared by all XARequestProcessors

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executorMapback to summary
private final ConcurrentMap<Xid, XAThreadPool.MultiRunner> executorMap
resourceImplback to summary
private final EhcacheXAResourceImpl resourceImpl
xaProcessorPoolback to summary
private static volatile XAThreadPool xaProcessorPool

Constructor Detail

XARequestProcessorback to summary
public XARequestProcessor(EhcacheXAResourceImpl resourceImpl)

Constructor

Parameters
resourceImpl:EhcacheXAResourceImpl

The EhcacheXAResourceImpl instance this processor will perform against

Method Detail

cleanupThreadback to summary
private void cleanupThread(Xid xid)

Removes the ExecutorService from the map and shuts it down

Parameters
xid:Xid

The Xid of the Transaction

getOrCreateThreadback to summary
private XAThreadPool.MultiRunner getOrCreateThread(Xid xid)

Gets the executor service for a Transaction, either by creating a new one if none exists, or returning the existing one

Parameters
xid:Xid

The Xid of the Transaction

Returns:XAThreadPool.MultiRunner

the ExecutorService for that Transaction

processback to summary
public int process(XARequest request) throws XAException

Process a XARequest

Parameters
request:XARequest

the XARequest

Returns:int

the XAResource response code

Exceptions
XAException:
the XAException thrown by the XAResource
shutdownback to summary
public static void shutdown()

Release resources shared by all XARequestProcessors

net.sf.ehcache.transaction.xa.processor back to summary

private Class XARequestProcessor.XARequestCallable

extends Object
implements Callable<XARequestProcessor.XAResponse>
Class Inheritance
  • java.lang.Object
  • net.sf.ehcache.transaction.xa.processor.XARequestProcessor.XARequestCallable
All Implemented Interfaces
java.util.concurrent.Callable

Class to furnish
Author
Nabib El-Rahman

Field Summary

Modifier and TypeField and Description
private final XARequest
private final EhcacheXAResourceImpl
private final Xid

Constructor Summary

AccessConstructor and Description
public
XARequestCallable(EhcacheXAResourceImpl
the EhcacheXAResourceImpl this Request will be used for
resourceImpl
,
XARequest
the actual Request
request
,
Xid xid)

Constructor

Method Summary

Modifier and TypeMethod and Description
public XARequestProcessor.XAResponse
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

requestback to summary
private final XARequest request
resourceImplback to summary
private final EhcacheXAResourceImpl resourceImpl
xidback to summary
private final Xid xid

Constructor Detail

XARequestCallableback to summary
public XARequestCallable(EhcacheXAResourceImpl resourceImpl, XARequest request, Xid xid)

Constructor

Parameters
resourceImpl:EhcacheXAResourceImpl

the EhcacheXAResourceImpl this Request will be used for

request:XARequest

the actual Request

Method Detail

callback to summary
public XARequestProcessor.XAResponse call() throws Exception

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:XARequestProcessor.XAResponse

computed result

Exceptions
Exception:
if unable to compute a result
net.sf.ehcache.transaction.xa.processor back to summary

private Class XARequestProcessor.XAResponse

extends Object
Class Inheritance
  • java.lang.Object
  • net.sf.ehcache.transaction.xa.processor.XARequestProcessor.XAResponse

Author
nelrahma

Field Summary

Modifier and TypeField and Description
private final int
private final XAException

Constructor Summary

AccessConstructor and Description
public
XAResponse(int
flags returned by the actual call against the XAResource
flags
,
XAException
Exception thrown by the call, otherwise null
xaException
)

Constructor

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the flags
getFlags
()

Gets the flags returned by the actual call against the XAResource

public XAException

Returns:

the exception, null if none
getXaException
()

Gets the Exception thrown by the actual call against the XAResource

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

flagsback to summary
private final int flags
xaExceptionback to summary
private final XAException xaException

Constructor Detail

XAResponseback to summary
public XAResponse(int flags, XAException xaException)

Constructor

Parameters
flags:int

flags returned by the actual call against the XAResource

xaException:XAException

Exception thrown by the call, otherwise null

Method Detail

getFlagsback to summary
public int getFlags()

Gets the flags returned by the actual call against the XAResource

Returns:int

the flags

getXaExceptionback to summary
public XAException getXaException()

Gets the Exception thrown by the actual call against the XAResource

Returns:XAException

the exception, null if none