com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple Java Examples

The following examples show how to use com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestConnectionWithNarayana.java    From commons-dbcp with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setUp() throws Exception {
    jtaPropertyManager.getJTAEnvironmentBean().setLastResourceOptimisationInterfaceClassName(
            "org.apache.commons.dbcp2.managed.LocalXAConnectionFactory$LocalXAResource");
    mds = new BasicManagedDataSource();
    mds.setTransactionManager(new TransactionManagerImple());
    mds.setDriverClassName("org.h2.Driver");
    mds.setUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");

    mds.setMaxTotal(80);
    mds.setMinIdle(0);
    mds.setMaxIdle(80);
    mds.setMinEvictableIdleTimeMillis(10000);
    mds.setTimeBetweenEvictionRunsMillis(10000);
    mds.setLogAbandoned(true);
    mds.setMaxWaitMillis(2000);
    mds.setRemoveAbandonedOnMaintenance(true);
    mds.setRemoveAbandonedOnBorrow(true);

    mds.setRemoveAbandonedTimeout(10);
    mds.setLogExpiredConnections(true);
    mds.setLifo(false);

    try (final Connection conn = mds.getConnection()) {
        try (final PreparedStatement ps = conn.prepareStatement(CREATE_STMT)) {
            ps.execute();
        }
    }
}
 
Example #2
Source File: NarayanaJtaProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
@Record(RUNTIME_INIT)
public void build(NarayanaJtaRecorder recorder,
        BuildProducer<AdditionalBeanBuildItem> additionalBeans,
        BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
        BuildProducer<RuntimeInitializedClassBuildItem> runtimeInit,
        BuildProducer<FeatureBuildItem> feature,
        TransactionManagerConfiguration transactions) {
    feature.produce(new FeatureBuildItem(Feature.NARAYANA_JTA));
    additionalBeans.produce(new AdditionalBeanBuildItem(NarayanaJtaProducers.class));
    additionalBeans.produce(new AdditionalBeanBuildItem(CDIDelegatingTransactionManager.class));
    runtimeInit.produce(new RuntimeInitializedClassBuildItem(
            "com.arjuna.ats.internal.jta.resources.arjunacore.CommitMarkableResourceRecord"));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, JTAEnvironmentBean.class.getName(),
            UserTransactionImple.class.getName(),
            CheckedActionFactoryImple.class.getName(),
            TransactionManagerImple.class.getName(),
            TransactionSynchronizationRegistryImple.class.getName(),
            ObjectStoreEnvironmentBean.class.getName(),
            ShadowNoFileLockStore.class.getName()));

    AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder();
    builder.addBeanClass(TransactionalInterceptorSupports.class);
    builder.addBeanClass(TransactionalInterceptorNever.class);
    builder.addBeanClass(TransactionalInterceptorRequired.class);
    builder.addBeanClass(TransactionalInterceptorRequiresNew.class);
    builder.addBeanClass(TransactionalInterceptorMandatory.class);
    builder.addBeanClass(TransactionalInterceptorNotSupported.class);
    additionalBeans.produce(builder.build());

    //we want to force Arjuna to init at static init time
    Properties defaultProperties = PropertiesFactory.getDefaultProperties();
    //we don't want to store the system properties here
    //we re-apply them at runtime
    for (Object i : System.getProperties().keySet()) {
        defaultProperties.remove(i);
    }
    recorder.setDefaultProperties(defaultProperties);
    // This must be done before setNodeName as the code in setNodeName will create a TSM based on the value of this property
    recorder.disableTransactionStatusManager();
    recorder.setNodeName(transactions);
    recorder.setDefaultTimeout(transactions);
}
 
Example #3
Source File: MDBMultipleHandlersServerDisconnectTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public static void startTM() {
   tm = new TransactionManagerImple();
   TxControl.enable();
}
 
Example #4
Source File: JMSBridgeClusteredTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
protected TransactionManager newTransactionManager() {
   return new TransactionManagerImple();
}
 
Example #5
Source File: BridgeTestBase.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
protected TransactionManager newTransactionManager() {
   return new TransactionManagerImple();
}
 
Example #6
Source File: XATest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
   super.setUp();

   xacf = ActiveMQJMSClient.createConnectionFactory("tcp://localhost:61616", "test");

   queue1 = createQueue("queue1");
   TxControl.enable();

   tm = new TransactionManagerImple();

   Assert.assertTrue(tm instanceof TransactionManagerImple);

   suspendedTx = tm.suspend();
}
 
Example #7
Source File: ActiveMQMessageHandlerTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public static void startTM() {
   tm = new TransactionManagerImple();
   TxControl.enable();
}
 
Example #8
Source File: InterruptedMessageHandlerTest.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
public static void startTM() {
   tm = new TransactionManagerImple();
   TxControl.enable();
}