Class Configuration
- All Implemented Interfaces:
Service
Configuration object.
Once the transaction manager has started it is not possible to change the configuration: all calls to setters will
throw a IllegalStateException.
The configuration filename must be specified with the bitronix.tm.configuration system property.
The default settings are good enough for running in a test environment but certainly not for production usage. Also, all properties are reset to their default value after the transaction manager has shut down.
All those properties can refer to other defined ones or to system properties using the Ant notation:
${some.property.name}.
- Author:
- lorban
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Build the server ID byte array that will be prepended in generated UIDs.intDeprecated.superceded by #getBackgroundRecoveryIntervalSeconds().intInterval in seconds at which to run the recovery process in the background.intDefault transaction timeout in seconds.Get the exception analyzer implementation.intMaximum amount of seconds the TM will wait for transactions to get done before aborting them at shutdown time.Get the name theTransactionSynchronizationRegistryshould be bound under in theBitronixContext.Get the name theUserTransactionshould be bound under in theBitronixContext.Get the journal implementation.Get the journal fragment file 1 name.Get the journal fragment file 2 name.intMaximum size in megabytes of the journal fragments.ResourceLoaderconfiguration file name.ASCII ID that must uniquely identify this TM instance.booleanShould the transaction manager allow enlistment of multiple LRC resources in a single transaction? This is highly unsafe but could be useful for testing.booleanShould two phase commit be executed asynchronously? Asynchronous two phase commit can improve performance when there are many resources enlisted in transactions but is more CPU intensive due to the dynamic thread spawning requirements.booleanShould the recovery process not recover XIDs generated with another JVM unique ID? Setting this property to true is useful in clustered environments where multiple instances of BTM are running on different nodes.booleanShould creation and commit call stacks of transactions executed without a single enlisted tracked and logged or not?booleanShould JMX Mbeans not be registered even if a JMX MBean server is detected?booleanUseful for debugging with less noise.booleanShould only mandatory logs be written? Enabling this parameter lowers space usage of the fragments but makes debugging more complex.booleanAre disk forces batched? Disabling batching can seriously lower the transaction manager's throughput.booleanAre logs forced to disk? Do not set to false in production since without disk force, integrity is not guaranteed.booleanShould corrupted logs be skipped?booleanShould transactions executed without a single enlisted resource result in a warning or not? Most of the time transactions executed with no enlisted resource reflect a bug or a mis-configuration somewhere.setAllowMultipleLrc(boolean allowMultipleLrc) Set to true if the transaction manager should allow enlistment of multiple LRC resources in a single transaction.setAsynchronous2Pc(boolean asynchronous2Pc) Set if two phase commit should be executed asynchronously.setBackgroundRecoveryInterval(int backgroundRecoveryInterval) Deprecated.superceded by #setBackgroundRecoveryIntervalSeconds(int).setBackgroundRecoveryIntervalSeconds(int backgroundRecoveryIntervalSeconds) Set the interval in seconds at which to run the recovery process in the background.setCurrentNodeOnlyRecovery(boolean currentNodeOnlyRecovery) Set to true if recovery should filter out recovered XIDs that do not contain this JVM's unique ID, false otherwise.setDebugZeroResourceTransaction(boolean debugZeroResourceTransaction) Set if creation and commit call stacks of transactions executed without a single enlisted resource should be tracked and logged.setDefaultTransactionTimeout(int defaultTransactionTimeout) Set the default transaction timeout in seconds.setDisableJmx(boolean disableJmx) Set to true if JMX Mbeans should not be registered even if a JMX MBean server is detected.setDisableRecovery(boolean disableRecovery) Useful for debugging with less noise.setExceptionAnalyzer(String exceptionAnalyzer) Set the exception analyzer implementation.setFilterLogStatus(boolean filterLogStatus) Set if only mandatory logs should be written.setForceBatchingEnabled(boolean forceBatchingEnabled) Set if disk forces are batched.setForcedWriteEnabled(boolean forcedWriteEnabled) Set if logs are forced to disk.setGracefulShutdownInterval(int gracefulShutdownInterval) Set the maximum amount of seconds the TM will wait for transactions to get done before aborting them at shutdown time.setJndiTransactionSynchronizationRegistryName(String jndiTransactionSynchronizationRegistryName) Set the name theTransactionSynchronizationRegistryshould be bound under in theBitronixContext.setJndiUserTransactionName(String jndiUserTransactionName) Set the name theUserTransactionshould be bound under in theBitronixContext.setJournal(String journal) Set the journal name.setLogPart1Filename(String logPart1Filename) Set the journal fragment file 1 name.setLogPart2Filename(String logPart2Filename) Set the journal fragment file 2 name.setMaxLogSizeInMb(int maxLogSizeInMb) Set the Maximum size in megabytes of the journal fragments.setResourceConfigurationFilename(String resourceConfigurationFilename) Set theResourceLoaderconfiguration file name.setServerId(String serverId) Set the ASCII ID that must uniquely identify this TM instance.setSkipCorruptedLogs(boolean skipCorruptedLogs) Set if corrupted logs should be skipped.setWarnAboutZeroResourceTransaction(boolean warnAboutZeroResourceTransaction) Set if transactions executed without a single enlisted resource should result in a warning or not.voidshutdown()Shutdown the service and free all held resources.toString()
-
Constructor Details
-
Configuration
protected Configuration()
-
-
Method Details
-
getServerId
ASCII ID that must uniquely identify this TM instance. It must not exceed 51 characters or it will be truncated.Property name:
bitronix.tm.serverId - (defaults to server's IP address but that's unsafe for production use)- Returns:
- the unique ID of this TM instance.
-
setServerId
Set the ASCII ID that must uniquely identify this TM instance. It must not exceed 51 characters or it will be truncated.- Parameters:
serverId- the unique ID of this TM instance.- Returns:
- this.
- See Also:
-
getLogPart1Filename
Get the journal fragment file 1 name.Property name:
bitronix.tm.journal.disk.logPart1Filename - (defaults to btm1.tlog)- Returns:
- the journal fragment file 1 name.
-
setLogPart1Filename
Set the journal fragment file 1 name.- Parameters:
logPart1Filename- the journal fragment file 1 name.- Returns:
- this.
- See Also:
-
getLogPart2Filename
Get the journal fragment file 2 name.Property name:
bitronix.tm.journal.disk.logPart2Filename - (defaults to btm2.tlog)- Returns:
- the journal fragment file 2 name.
-
setLogPart2Filename
Set the journal fragment file 2 name.- Parameters:
logPart2Filename- the journal fragment file 2 name.- Returns:
- this.
- See Also:
-
isForcedWriteEnabled
public boolean isForcedWriteEnabled()Are logs forced to disk? Do not set to false in production since without disk force, integrity is not guaranteed.Property name:
bitronix.tm.journal.disk.forcedWriteEnabled - (defaults to true)- Returns:
- true if logs are forced to disk, false otherwise.
-
setForcedWriteEnabled
Set if logs are forced to disk. Do not set to false in production since without disk force, integrity is not guaranteed.- Parameters:
forcedWriteEnabled- true if logs should be forced to disk, false otherwise.- Returns:
- this.
- See Also:
-
isForceBatchingEnabled
public boolean isForceBatchingEnabled()Are disk forces batched? Disabling batching can seriously lower the transaction manager's throughput.Property name:
bitronix.tm.journal.disk.forceBatchingEnabled - (defaults to true)- Returns:
- true if disk forces are batched, false otherwise.
-
setForceBatchingEnabled
Set if disk forces are batched. Disabling batching can seriously lower the transaction manager's throughput.- Parameters:
forceBatchingEnabled- true if disk forces are batched, false otherwise.- Returns:
- this.
- See Also:
-
getMaxLogSizeInMb
public int getMaxLogSizeInMb()Maximum size in megabytes of the journal fragments. Larger logs allow transactions to stay longer in-doubt but the TM pauses longer when a fragment is full.Property name:
bitronix.tm.journal.disk.maxLogSize - (defaults to 2)- Returns:
- the maximum size in megabytes of the journal fragments.
-
setMaxLogSizeInMb
Set the Maximum size in megabytes of the journal fragments. Larger logs allow transactions to stay longer in-doubt but the TM pauses longer when a fragment is full.- Parameters:
maxLogSizeInMb- the maximum size in megabytes of the journal fragments.- Returns:
- this.
- See Also:
-
isFilterLogStatus
public boolean isFilterLogStatus()Should only mandatory logs be written? Enabling this parameter lowers space usage of the fragments but makes debugging more complex.Property name:
bitronix.tm.journal.disk.filterLogStatus - (defaults to false)- Returns:
- true if only mandatory logs should be written.
-
setFilterLogStatus
Set if only mandatory logs should be written. Enabling this parameter lowers space usage of the fragments but makes debugging more complex.- Parameters:
filterLogStatus- true if only mandatory logs should be written.- Returns:
- this.
- See Also:
-
isSkipCorruptedLogs
public boolean isSkipCorruptedLogs()Should corrupted logs be skipped?Property name:
bitronix.tm.journal.disk.skipCorruptedLogs - (defaults to false)- Returns:
- true if corrupted logs should be skipped.
-
setSkipCorruptedLogs
Set if corrupted logs should be skipped.- Parameters:
skipCorruptedLogs- true if corrupted logs should be skipped.- Returns:
- this.
- See Also:
-
isAsynchronous2Pc
public boolean isAsynchronous2Pc()Should two phase commit be executed asynchronously? Asynchronous two phase commit can improve performance when there are many resources enlisted in transactions but is more CPU intensive due to the dynamic thread spawning requirements. It also makes debugging more complex.Property name:
bitronix.tm.2pc.async - (defaults to false)- Returns:
- true if two phase commit should be executed asynchronously.
-
setAsynchronous2Pc
Set if two phase commit should be executed asynchronously. Asynchronous two phase commit can improve performance when there are many resources enlisted in transactions but is more CPU intensive due to the dynamic thread spawning requirements. It also makes debugging more complex.- Parameters:
asynchronous2Pc- true if two phase commit should be executed asynchronously.- Returns:
- this.
- See Also:
-
isWarnAboutZeroResourceTransaction
public boolean isWarnAboutZeroResourceTransaction()Should transactions executed without a single enlisted resource result in a warning or not? Most of the time transactions executed with no enlisted resource reflect a bug or a mis-configuration somewhere.Property name:
bitronix.tm.2pc.warnAboutZeroResourceTransactions - (defaults to true)- Returns:
- true if transactions executed without a single enlisted resource should result in a warning.
-
setWarnAboutZeroResourceTransaction
Set if transactions executed without a single enlisted resource should result in a warning or not. Most of the time transactions executed with no enlisted resource reflect a bug or a mis-configuration somewhere.- Parameters:
warnAboutZeroResourceTransaction- true if transactions executed without a single enlisted resource should result in a warning.- Returns:
- this.
- See Also:
-
isDebugZeroResourceTransaction
public boolean isDebugZeroResourceTransaction()Should creation and commit call stacks of transactions executed without a single enlisted tracked and logged or not?Property name:
bitronix.tm.2pc.debugZeroResourceTransactions - (defaults to false)- Returns:
- true if creation and commit call stacks of transactions executed without a single enlisted resource should be tracked and logged.
-
setDebugZeroResourceTransaction
Set if creation and commit call stacks of transactions executed without a single enlisted resource should be tracked and logged.- Parameters:
debugZeroResourceTransaction- true if the creation and commit call stacks of transaction executed without a single enlisted resource should be tracked and logged.- Returns:
- this.
- See Also:
-
getDefaultTransactionTimeout
public int getDefaultTransactionTimeout()Default transaction timeout in seconds.Property name:
bitronix.tm.timer.defaultTransactionTimeout - (defaults to 60)- Returns:
- the default transaction timeout in seconds.
-
setDefaultTransactionTimeout
Set the default transaction timeout in seconds.- Parameters:
defaultTransactionTimeout- the default transaction timeout in seconds.- Returns:
- this.
- See Also:
-
getGracefulShutdownInterval
public int getGracefulShutdownInterval()Maximum amount of seconds the TM will wait for transactions to get done before aborting them at shutdown time.Property name:
bitronix.tm.timer.gracefulShutdownInterval - (defaults to 60)- Returns:
- the maximum amount of time in seconds.
-
setGracefulShutdownInterval
Set the maximum amount of seconds the TM will wait for transactions to get done before aborting them at shutdown time.- Parameters:
gracefulShutdownInterval- the maximum amount of time in seconds.- Returns:
- this.
- See Also:
-
getBackgroundRecoveryInterval
Deprecated.superceded by #getBackgroundRecoveryIntervalSeconds().Interval in minutes at which to run the recovery process in the background. Disabled when set to 0.Property name:
bitronix.tm.timer.backgroundRecoveryInterval - (defaults to 0)- Returns:
- the interval in minutes.
-
setBackgroundRecoveryInterval
Deprecated.superceded by #setBackgroundRecoveryIntervalSeconds(int).Set the interval in minutes at which to run the recovery process in the background. Disabled when set to 0.- Parameters:
backgroundRecoveryInterval- the interval in minutes.- Returns:
- this.
- See Also:
-
getBackgroundRecoveryIntervalSeconds
public int getBackgroundRecoveryIntervalSeconds()Interval in seconds at which to run the recovery process in the background. Disabled when set to 0.Property name:
bitronix.tm.timer.backgroundRecoveryIntervalSeconds - (defaults to 60)- Returns:
- the interval in seconds.
-
setBackgroundRecoveryIntervalSeconds
Set the interval in seconds at which to run the recovery process in the background. Disabled when set to 0.- Parameters:
backgroundRecoveryIntervalSeconds- the interval in minutes.- Returns:
- this.
- See Also:
-
isDisableJmx
public boolean isDisableJmx()Should JMX Mbeans not be registered even if a JMX MBean server is detected?Property name:
bitronix.tm.disableJmx - (defaults to false)- Returns:
- true if JMX MBeans should never be registered.
-
setDisableJmx
Set to true if JMX Mbeans should not be registered even if a JMX MBean server is detected.- Parameters:
disableJmx- true if JMX MBeans should never be registered.- Returns:
- this.
- See Also:
-
getJndiUserTransactionName
Get the name theUserTransactionshould be bound under in theBitronixContext.- Returns:
- the name the
UserTransactionshould be bound under in theBitronixContext.
-
setJndiUserTransactionName
Set the name theUserTransactionshould be bound under in theBitronixContext.- Parameters:
jndiUserTransactionName- the name theUserTransactionshould be bound under in theBitronixContext.- Returns:
- this.
- See Also:
-
getJndiTransactionSynchronizationRegistryName
Get the name theTransactionSynchronizationRegistryshould be bound under in theBitronixContext.- Returns:
- the name the
TransactionSynchronizationRegistryshould be bound under in theBitronixContext.
-
setJndiTransactionSynchronizationRegistryName
public Configuration setJndiTransactionSynchronizationRegistryName(String jndiTransactionSynchronizationRegistryName) Set the name theTransactionSynchronizationRegistryshould be bound under in theBitronixContext.- Parameters:
jndiTransactionSynchronizationRegistryName- the name theTransactionSynchronizationRegistryshould be bound under in theBitronixContext.- Returns:
- this.
- See Also:
-
getJournal
Get the journal implementation. Can bedisk,nullor a class name.- Returns:
- the journal name.
-
setJournal
Set the journal name. Can bedisk,nullor a class name.- Parameters:
journal- the journal name.- Returns:
- this.
- See Also:
-
getExceptionAnalyzer
Get the exception analyzer implementation. Can benullfor the default one or a class name.- Returns:
- the exception analyzer name.
-
setExceptionAnalyzer
Set the exception analyzer implementation. Can benullfor the default one or a class name.- Parameters:
exceptionAnalyzer- the exception analyzer name.- Returns:
- this.
- See Also:
-
isCurrentNodeOnlyRecovery
public boolean isCurrentNodeOnlyRecovery()Should the recovery process not recover XIDs generated with another JVM unique ID? Setting this property to true is useful in clustered environments where multiple instances of BTM are running on different nodes.- Returns:
- true if recovery should filter out recovered XIDs that do not contain this JVM's unique ID, false otherwise.
- See Also:
-
setCurrentNodeOnlyRecovery
Set to true if recovery should filter out recovered XIDs that do not contain this JVM's unique ID, false otherwise.- Parameters:
currentNodeOnlyRecovery- true if recovery should filter out recovered XIDs that do not contain this JVM's unique ID, false otherwise.- Returns:
- this.
- See Also:
-
isAllowMultipleLrc
public boolean isAllowMultipleLrc()Should the transaction manager allow enlistment of multiple LRC resources in a single transaction? This is highly unsafe but could be useful for testing.- Returns:
- true if the transaction manager should allow enlistment of multiple LRC resources in a single transaction, false otherwise.
-
setAllowMultipleLrc
Set to true if the transaction manager should allow enlistment of multiple LRC resources in a single transaction.- Parameters:
allowMultipleLrc- true if the transaction manager should allow enlistment of multiple LRC resources in a single transaction, false otherwise.- Returns:
- this
-
getResourceConfigurationFilename
ResourceLoaderconfiguration file name.ResourceLoaderwill be disabled if this value is null.Property name:
bitronix.tm.resource.configuration - (defaults to null)- Returns:
- the filename of the resources configuration file or null if not configured.
-
setResourceConfigurationFilename
Set theResourceLoaderconfiguration file name.- Parameters:
resourceConfigurationFilename- the filename of the resources configuration file or null you do not want to use theResourceLoader.- Returns:
- this.
- See Also:
-
isDisableRecovery
public boolean isDisableRecovery()Useful for debugging with less noise.- Returns:
- whether recovery is disabled or not.
- Since:
- 3.0
-
setDisableRecovery
Useful for debugging with less noise.- Parameters:
disableRecovery- whether recovery is disabled or not.- Returns:
- this.
- Since:
- 3.0
-
buildServerIdArray
public byte[] buildServerIdArray()Build the server ID byte array that will be prepended in generated UIDs. Once built, the value is cached for the duration of the JVM lifespan.- Returns:
- the server ID.
-
shutdown
public void shutdown()Description copied from interface:ServiceShutdown the service and free all held resources. -
toString
-