Class AtomikosProperties
- java.lang.Object
- org.springframework.boot.jta.atomikos.AtomikosProperties
@ConfigurationProperties(prefix="spring.jta.atomikos.properties") public class AtomikosProperties extends Object
Bean friendly variant of Atomikos configuration properties. Allows for setter based configuration and is amiable to relaxed data binding.- Since:
- 1.2.0
- See Also:
asProperties()
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AtomikosProperties.Recovery
Recovery specific settings.
Constructor Summary
Constructors Constructor Description AtomikosProperties()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Properties
asProperties()
Returns the properties as aProperties
object that can be used with Atomikos.long
getCheckpointInterval()
Duration
getDefaultJtaTimeout()
long
getDefaultMaxWaitTimeOnShutdown()
String
getLogBaseDir()
String
getLogBaseName()
int
getMaxActives()
Duration
getMaxTimeout()
AtomikosProperties.Recovery
getRecovery()
String
getService()
String
getTransactionManagerUniqueName()
boolean
isAllowSubTransactions()
boolean
isEnableLogging()
boolean
isForceShutdownOnVmExit()
boolean
isSerialJtaTransactions()
boolean
isThreadedTwoPhaseCommit()
void
setAllowSubTransactions(boolean allowSubTransactions)
void
setCheckpointInterval(long checkpointInterval)
Specifies the interval between checkpoints.void
setDefaultJtaTimeout(Duration defaultJtaTimeout)
The default timeout for JTA transactions (optional, defaults to 10000 ms).void
setDefaultMaxWaitTimeOnShutdown(long defaultMaxWaitTimeOnShutdown)
Specifies how long should a normal shutdown (no-force) wait for transactions to complete.void
setEnableLogging(boolean enableLogging)
Specifies if disk logging should be enabled or not.void
setForceShutdownOnVmExit(boolean forceShutdownOnVmExit)
Specifies whether VM shutdown should trigger forced shutdown of the transaction core.void
setLogBaseDir(String logBaseDir)
Specifies the directory in which the log files should be stored.void
setLogBaseName(String logBaseName)
Specifies the transactions log file base name.void
setMaxActives(int maxActives)
Specifies the maximum number of active transactions.void
setMaxTimeout(Duration maxTimeout)
Specifies the maximum timeout that can be allowed for transactions.void
setSerialJtaTransactions(boolean serialJtaTransactions)
Specifies if subtransactions should be joined when possible.void
setService(String service)
Specifies the transaction manager implementation that should be started.void
setThreadedTwoPhaseCommit(boolean threadedTwoPhaseCommit)
Specifies whether or not to use different (and concurrent) threads for two-phase commit on the participating resources.void
setTransactionManagerUniqueName(String uniqueName)
Specifies the transaction manager's unique name.
Constructor Detail
AtomikosProperties
public AtomikosProperties()
Method Detail
setService
public void setService(String service)
Specifies the transaction manager implementation that should be started. There is no default value and this must be set. Generally, com.atomikos.icatch.standalone.UserTransactionServiceFactory is the value you should set.- Parameters:
service
- the service
getService
public String getService()
setMaxTimeout
public void setMaxTimeout(Duration maxTimeout)
Specifies the maximum timeout that can be allowed for transactions. Defaults to 300000. This means that calls to UserTransaction.setTransactionTimeout() with a value higher than configured here will be max'ed to this value.- Parameters:
maxTimeout
- the max timeout
getMaxTimeout
public Duration getMaxTimeout()
setDefaultJtaTimeout
public void setDefaultJtaTimeout(Duration defaultJtaTimeout)
The default timeout for JTA transactions (optional, defaults to 10000 ms).- Parameters:
defaultJtaTimeout
- the default JTA timeout
getDefaultJtaTimeout
public Duration getDefaultJtaTimeout()
setMaxActives
public void setMaxActives(int maxActives)
Specifies the maximum number of active transactions. Defaults to 50. A negative value means infinite amount. You will get anIllegalStateException
with error message "Max number of active transactions reached" if you callUserTransaction.begin()
while there are already n concurrent transactions running, n being this value.- Parameters:
maxActives
- the max activities
getMaxActives
public int getMaxActives()
setEnableLogging
public void setEnableLogging(boolean enableLogging)
Specifies if disk logging should be enabled or not. Defaults to true. It is useful for JUnit testing, or to profile code without seeing the transaction manager's activity as a hot spot but this should never be disabled on production or data integrity cannot be guaranteed.- Parameters:
enableLogging
- if logging is enabled
isEnableLogging
public boolean isEnableLogging()
setTransactionManagerUniqueName
public void setTransactionManagerUniqueName(String uniqueName)
Specifies the transaction manager's unique name. Defaults to the machine's IP address. If you plan to run more than one transaction manager against one database you must set this property to a unique value or you might run into duplicate transaction ID (XID) problems that can be quite subtle (example: http://fogbugz.atomikos.com/default.asp?community.6.2225.7). If multiple instances need to use the same properties file then the easiest way to ensure uniqueness for this property is by referencing a system property specified at VM startup.- Parameters:
uniqueName
- the unique name
getTransactionManagerUniqueName
public String getTransactionManagerUniqueName()
setSerialJtaTransactions
public void setSerialJtaTransactions(boolean serialJtaTransactions)
Specifies if subtransactions should be joined when possible. Defaults to true. When false, no attempt to callXAResource.start(TM_JOIN)
will be made for different but related subtransactions. This setting has no effect on resource access within one and the same transaction. If you don't use subtransactions then this setting can be ignored.- Parameters:
serialJtaTransactions
- if serial JTA transactions are supported
isSerialJtaTransactions
public boolean isSerialJtaTransactions()
setAllowSubTransactions
public void setAllowSubTransactions(boolean allowSubTransactions)
isAllowSubTransactions
public boolean isAllowSubTransactions()
setForceShutdownOnVmExit
public void setForceShutdownOnVmExit(boolean forceShutdownOnVmExit)
Specifies whether VM shutdown should trigger forced shutdown of the transaction core. Defaults to false.- Parameters:
forceShutdownOnVmExit
- if VM shutdown should be forced
isForceShutdownOnVmExit
public boolean isForceShutdownOnVmExit()
setDefaultMaxWaitTimeOnShutdown
public void setDefaultMaxWaitTimeOnShutdown(long defaultMaxWaitTimeOnShutdown)
Specifies how long should a normal shutdown (no-force) wait for transactions to complete. Defaults to Long.MAX_VALUE.- Parameters:
defaultMaxWaitTimeOnShutdown
- the default max wait time on shutdown
getDefaultMaxWaitTimeOnShutdown
public long getDefaultMaxWaitTimeOnShutdown()
setLogBaseName
public void setLogBaseName(String logBaseName)
Specifies the transactions log file base name. Defaults to tmlog. The transactions logs are stored in files using this name appended with a number and the extension .log. At checkpoint, a new transactions log file is created and the number is incremented.- Parameters:
logBaseName
- the log base name
getLogBaseName
public String getLogBaseName()
setLogBaseDir
public void setLogBaseDir(String logBaseDir)
Specifies the directory in which the log files should be stored. Defaults to the current working directory. This directory should be a stable storage like a SAN, RAID or at least backed up location. The transactions logs files are as important as the data themselves to guarantee consistency in case of failures.- Parameters:
logBaseDir
- the log base dir
getLogBaseDir
public String getLogBaseDir()
setCheckpointInterval
public void setCheckpointInterval(long checkpointInterval)
Specifies the interval between checkpoints. A checkpoint reduces the log file size at the expense of adding some overhead in the runtime. Defaults to 500.- Parameters:
checkpointInterval
- the checkpoint interval
getCheckpointInterval
public long getCheckpointInterval()
setThreadedTwoPhaseCommit
public void setThreadedTwoPhaseCommit(boolean threadedTwoPhaseCommit)
Specifies whether or not to use different (and concurrent) threads for two-phase commit on the participating resources. Setting this to true implies that the commit is more efficient since waiting for acknowledgements is done in parallel. Defaults to true. If you set this to false, then commits will happen in the order that resources are accessed within the transaction.- Parameters:
threadedTwoPhaseCommit
- if threaded two phase commits should be used
isThreadedTwoPhaseCommit
public boolean isThreadedTwoPhaseCommit()
getRecovery
public AtomikosProperties.Recovery getRecovery()
asProperties
public Properties asProperties()
Returns the properties as aProperties
object that can be used with Atomikos.- Returns:
- the properties