com.arjuna.ats.jta.common.JTAEnvironmentBean Java Examples
The following examples show how to use
com.arjuna.ats.jta.common.JTAEnvironmentBean.
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: NarayanaPropertiesInitializer.java From narayana-spring-boot with Apache License 2.0 | 4 votes |
private void setXARecoveryNodes(List<String> xaRecoveryNodes) { getPopulator(JTAEnvironmentBean.class).setXaRecoveryNodes(xaRecoveryNodes); }
Example #2
Source File: NarayanaPropertiesInitializer.java From narayana-spring-boot with Apache License 2.0 | 4 votes |
private void setXaResourceOrphanFilters(List<String> xaResourceOrphanFilters) { getPopulator(JTAEnvironmentBean.class).setXaResourceOrphanFilterClassNames(xaResourceOrphanFilters); }
Example #3
Source File: NarayanaPropertiesInitializerTests.java From narayana-spring-boot with Apache License 2.0 | 4 votes |
@Test public void shouldSetDefaultProperties() throws Exception { NarayanaProperties narayanaProperties = new NarayanaProperties(); NarayanaPropertiesInitializer narayanaPropertiesInitializer = new NarayanaPropertiesInitializer(narayanaProperties); narayanaPropertiesInitializer.afterPropertiesSet(); assertThat(BeanPopulator.getDefaultInstance(CoreEnvironmentBean.class) .getNodeIdentifier()).isEqualTo("1"); assertThat(BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class) .getObjectStoreDir()).endsWith("ObjectStore"); assertThat(BeanPopulator .getNamedInstance(ObjectStoreEnvironmentBean.class, "communicationStore") .getObjectStoreDir()).endsWith("ObjectStore"); assertThat(BeanPopulator .getNamedInstance(ObjectStoreEnvironmentBean.class, "stateStore") .getObjectStoreDir()).endsWith("ObjectStore"); assertThat(BeanPopulator.getDefaultInstance(CoordinatorEnvironmentBean.class) .isCommitOnePhase()).isTrue(); assertThat(BeanPopulator.getDefaultInstance(CoordinatorEnvironmentBean.class) .getDefaultTimeout()).isEqualTo(60); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getPeriodicRecoveryPeriod()).isEqualTo(120); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getRecoveryBackoffPeriod()).isEqualTo(10); List<String> xaResourceOrphanFilters = Arrays.asList( "com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter", "com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter"); assertThat(BeanPopulator.getDefaultInstance(JTAEnvironmentBean.class) .getXaResourceOrphanFilterClassNames()) .isEqualTo(xaResourceOrphanFilters); List<String> recoveryModules = Arrays.asList( "com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule", "com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule"); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getRecoveryModuleClassNames()).isEqualTo(recoveryModules); List<String> expiryScanners = Arrays.asList( "com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner"); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getExpiryScannerClassNames()).isEqualTo(expiryScanners); assertThat(BeanPopulator.getDefaultInstance(JTAEnvironmentBean.class) .getXaResourceRecoveryClassNames()).isEmpty(); }
Example #4
Source File: NarayanaPropertiesInitializerTests.java From narayana-spring-boot with Apache License 2.0 | 4 votes |
@Test public void shouldSetModifiedProperties() throws Exception { NarayanaProperties narayanaProperties = new NarayanaProperties(); narayanaProperties.setTransactionManagerId("test-id"); narayanaProperties.setLogDir("test-dir"); narayanaProperties.setDefaultTimeout(1); narayanaProperties.setPeriodicRecoveryPeriod(2); narayanaProperties.setRecoveryBackoffPeriod(3); narayanaProperties.setOnePhaseCommit(false); narayanaProperties.setXaResourceOrphanFilters(Arrays.asList("test-filter-1", "test-filter-2")); narayanaProperties.setRecoveryModules(Arrays.asList("test-module-1", "test-module-2")); narayanaProperties.setExpiryScanners(Arrays.asList("test-scanner-1", "test-scanner-2")); NarayanaPropertiesInitializer narayanaPropertiesInitializer = new NarayanaPropertiesInitializer(narayanaProperties); narayanaPropertiesInitializer.afterPropertiesSet(); assertThat(BeanPopulator.getDefaultInstance(CoreEnvironmentBean.class) .getNodeIdentifier()).isEqualTo("test-id"); assertThat(BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class) .getObjectStoreDir()).isEqualTo("test-dir"); assertThat(BeanPopulator .getNamedInstance(ObjectStoreEnvironmentBean.class, "communicationStore") .getObjectStoreDir()).isEqualTo("test-dir"); assertThat(BeanPopulator .getNamedInstance(ObjectStoreEnvironmentBean.class, "stateStore") .getObjectStoreDir()).isEqualTo("test-dir"); assertThat(BeanPopulator.getDefaultInstance(CoordinatorEnvironmentBean.class) .isCommitOnePhase()).isFalse(); assertThat(BeanPopulator.getDefaultInstance(CoordinatorEnvironmentBean.class) .getDefaultTimeout()).isEqualTo(1); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getPeriodicRecoveryPeriod()).isEqualTo(2); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getRecoveryBackoffPeriod()).isEqualTo(3); assertThat(BeanPopulator.getDefaultInstance(JTAEnvironmentBean.class) .getXaResourceOrphanFilterClassNames()) .isEqualTo(Arrays.asList("test-filter-1", "test-filter-2")); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getRecoveryModuleClassNames()) .isEqualTo(Arrays.asList("test-module-1", "test-module-2")); assertThat(BeanPopulator.getDefaultInstance(RecoveryEnvironmentBean.class) .getExpiryScannerClassNames()) .isEqualTo(Arrays.asList("test-scanner-1", "test-scanner-2")); }
Example #5
Source File: NarayanaJtaProcessor.java From quarkus with Apache License 2.0 | 4 votes |
@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); }