use of org.wildfly.transaction.client.LocalTransactionContext in project wildfly by wildfly.
the class EJBClientXidTransactionTestCase method beforeTestClass.
/**
* Create and setup the remoting connection
*
* @throws Exception
*/
@BeforeClass
public static void beforeTestClass() throws Exception {
// These system properties are required or else we end up picking up JTS transaction manager,
// which is not what we want
final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
jtaEnvironmentBean.setTransactionManagerClassName(TransactionManagerImple.class.getName());
jtaEnvironmentBean.setTransactionSynchronizationRegistryClassName(TransactionSynchronizationRegistryImple.class.getName());
final TransactionManager narayanaTm = jtaEnvironmentBean.getTransactionManager();
final TransactionSynchronizationRegistry narayanaTsr = jtaEnvironmentBean.getTransactionSynchronizationRegistry();
final XATerminator xat = new XATerminator();
final JBossLocalTransactionProvider.Builder builder = JBossLocalTransactionProvider.builder();
builder.setXATerminator(xat).setExtendedJBossXATerminator(xat);
builder.setTransactionManager(narayanaTm);
builder.setTransactionSynchronizationRegistry(narayanaTsr);
LocalTransactionContext.getContextManager().setGlobalDefault(new LocalTransactionContext(builder.build()));
txManager = ContextTransactionManager.getInstance();
txSyncRegistry = ContextTransactionSynchronizationRegistry.getInstance();
// setup the tx manager and tx sync registry
}
use of org.wildfly.transaction.client.LocalTransactionContext in project wildfly by wildfly.
the class HTTPEJBClientXidTransactionTestCase method beforeTestClass.
/**
* Create and setup the remoting connection
*
* @throws Exception
*/
@BeforeClass
public static void beforeTestClass() throws Exception {
// These system properties are required or else we end up picking up JTS transaction manager,
// which is not what we want
final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
jtaEnvironmentBean.setTransactionManagerClassName(TransactionManagerImple.class.getName());
jtaEnvironmentBean.setTransactionSynchronizationRegistryClassName(TransactionSynchronizationRegistryImple.class.getName());
final TransactionManager narayanaTm = jtaEnvironmentBean.getTransactionManager();
final TransactionSynchronizationRegistry narayanaTsr = jtaEnvironmentBean.getTransactionSynchronizationRegistry();
final XATerminator xat = new XATerminator();
final JBossLocalTransactionProvider.Builder builder = JBossLocalTransactionProvider.builder();
builder.setXATerminator(xat).setExtendedJBossXATerminator(xat);
builder.setTransactionManager(narayanaTm);
builder.setTransactionSynchronizationRegistry(narayanaTsr);
LocalTransactionContext.getContextManager().setGlobalDefault(new LocalTransactionContext(builder.build()));
txManager = ContextTransactionManager.getInstance();
txSyncRegistry = ContextTransactionSynchronizationRegistry.getInstance();
// setup the tx manager and tx sync registry
AuthenticationConfiguration config = AuthenticationConfiguration.EMPTY.useName("user1").usePassword("password1");
AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, config);
old = AuthenticationContext.captureCurrent();
AuthenticationContext.getContextManager().setGlobalDefault(context);
}
use of org.wildfly.transaction.client.LocalTransactionContext in project wildfly by wildfly.
the class EJBSuspendHandlerService method start.
/**
* Starts the service. Registers server activity, sets transaction listener on local transaction context, and creates and
* installs deployment controller service.
*
* @param context start context
*/
public void start(StartContext context) {
final SuspendController suspendController = suspendControllerInjectedValue.getValue();
suspendController.registerActivity(this);
final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue();
localTransactionContext.registerCreationListener(this);
}
use of org.wildfly.transaction.client.LocalTransactionContext in project wildfly by wildfly.
the class EJBSuspendHandlerService method stop.
/**
* Stops the service. Unregisters service activity and clears transaction listener.
* @param context stop context
*/
public void stop(StopContext context) {
final SuspendController suspendController = suspendControllerInjectedValue.getValue();
suspendController.unRegisterActivity(this);
final LocalTransactionContext localTransactionContext = localTransactionContextInjectedValue.getValue();
localTransactionContext.removeCreationListener(this);
}
use of org.wildfly.transaction.client.LocalTransactionContext in project wildfly by wildfly.
the class LocalTransactionContextService method start.
public void start(final StartContext context) throws StartException {
JBossLocalTransactionProvider.Builder builder = JBossLocalTransactionProvider.builder();
builder.setExtendedJBossXATerminator(extendedJBossXATerminatorInjector.getValue());
builder.setTransactionManager(transactionManagerInjector.getValue().getTransactionManager());
builder.setTransactionSynchronizationRegistry(transactionManagerInjector.getValue().getTransactionSynchronizationRegistry());
builder.setXATerminator(transactionManagerInjector.getValue().getJbossXATerminator());
final LocalTransactionContext transactionContext = this.context = new LocalTransactionContext(builder.build());
// TODO: replace this with per-CL settings for embedded use and to support remote UserTransaction
doPrivileged((PrivilegedAction<Void>) () -> {
LocalTransactionContext.getContextManager().setGlobalDefault(transactionContext);
return null;
});
}
Aggregations