public InterceptorsImpl(TransactionSupport transactionSupport,
PoolingSupport pooling,
String objectName,
RealmBridge realmBridge,
ConnectionTracker connectionTracker,
TransactionContextManager transactionContextManager,
ClassLoader classLoader) {
//check for consistency between attributes
if (realmBridge == null && pooling instanceof PartitionedPool && ((PartitionedPool) pooling).isPartitionBySubject()) {
throw new IllegalStateException("To use Subject in pooling, you need a SecurityDomain");
}
//Set up the interceptor stack
MCFConnectionInterceptor tail = new MCFConnectionInterceptor();
ConnectionInterceptor stack = tail;
stack = transactionSupport.addXAResourceInsertionInterceptor(stack, objectName);
stack = pooling.addPoolingInterceptors(stack);
this.poolingSupport = pooling;
//experimental threadlocal caching
//moved to XATransactions
// if (transactionSupport instanceof XATransactions && ((XATransactions)transactionSupport).isUseThreadCaching()) {
// stack = new ThreadLocalCachingConnectionInterceptor(stack, false);
// }
stack = transactionSupport.addTransactionInterceptors(stack, transactionContextManager);
if (realmBridge != null) {
stack = new SubjectInterceptor(stack, realmBridge);
}
ConnectionInterceptor recoveryStack = stack;
this.recoveryStack = new TCCLInterceptor(recoveryStack, classLoader);
stack = new ConnectionHandleInterceptor(stack);
stack = new TCCLInterceptor(stack, classLoader);
if (connectionTracker != null) {
stack = new ConnectionTrackingInterceptor(stack,
objectName,
connectionTracker);
}
tail.setStack(stack);
this.stack = stack;
}
Order of constructed interceptors:
ConnectionTrackingInterceptor (connectionTracker != null)
TCCLInterceptor
ConnectionHandleInterceptor
TransactionCachingInterceptor (useTransactions & useTransactionCaching)
TransactionEnlistingInterceptor (useTransactions)
SubjectInterceptor (realmBridge != null)
SinglePoolConnectionInterceptor or MultiPoolConnectionInterceptor
LocalXAResourceInsertionInterceptor or XAResourceInsertionInterceptor (useTransactions (&localTransactions))
MCFConnectionInterceptor |