Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace UserTransactionServiceImp destroy method with shutdownForce in AtomikosAutoConfiguration #231

Open
fabiomolignoni opened this issue Sep 23, 2024 · 0 comments

Comments

@fabiomolignoni
Copy link

Bug Description:

The Atomikos Spring Integration documentation specifies that the UserTransactionServiceImp class should be initialized with shutdownForce as the destroy method:

<bean id="userTransactionService"  
  class="com.atomikos.icatch.config.UserTransactionServiceImp"  
  init-method="init" 
  destroy-method="shutdownForce"> 
    <constructor-arg> 
        <!-- IMPORTANT: specify all Atomikos properties here --> 
        <props> 
            <prop key="com.atomikos.icatch.service"> 
              com.atomikos.icatch.standalone.UserTransactionServiceFactory 
            </prop> 
        </props> 
    </constructor-arg> 
</bean> 

However, in the AtomikosAutoConfiguration class, the destroy method is incorrectly set to shutdownWait instead of shutdownForce:

@Bean(initMethod = "init", destroyMethod = "shutdownWait")
@ConditionalOnMissingBean(UserTransactionService.class)
UserTransactionServiceImp userTransactionService(
    SpringJtaAtomikosProperties springJtaAtomikosProperties,
    AtomikosProperties atomikosProperties
) {
    Properties properties = new Properties();
    properties.putAll(springJtaAtomikosProperties.asProperties());
    properties.putAll(atomikosProperties.asProperties());
    return new UserTransactionServiceImp(properties);
}

Issue:
Using shutdownWait can cause issues during the shutdown phase, especially when working with Oracle databases, leading to ORA-17008 exceptions (closed connection).

Expected Behavior:
The destroy method should align with the documentation, which uses shutdownForce, to prevent connection closure issues.

Proposed Solution:
Replace the destroy method shutdownWait with shutdownForce in the AtomikosAutoConfiguration class:

@Bean(initMethod = "init", destroyMethod = "shutdownForce")
@ConditionalOnMissingBean(UserTransactionService.class)
UserTransactionServiceImp userTransactionService(
    SpringJtaAtomikosProperties springJtaAtomikosProperties,
    AtomikosProperties atomikosProperties
) {
    Properties properties = new Properties();
    properties.putAll(springJtaAtomikosProperties.asProperties());
    properties.putAll(atomikosProperties.asProperties());
    return new UserTransactionServiceImp(properties);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant