8.2. Using the Provided Lockers
- shared file locker—used by file-based message stores like KahaDB and LevelDB
- database locker—used as the default for JDBC message stores
- lease database locker—used as an alternative locker for JDBC message stores in scenarios where brokers have inconsistent connections to the message store
8.2.2. Database Locker
Overview
- intermittent database connectivity
- database failover
Configuration
database-locker element.
Example 8.3. Configuring a Database Locker
<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" lockKeepAlivePeriod="2000">
<locker>
<database-locker lockAcquireSleepInterval="10000"/>
</locker>
</jdbcPersistenceAdapter>
</persistenceAdapter>Intermittent database connectivity
Database failover
8.2.3. Lease Database Locker
Overview
lockKeepAlivePeriod attribute. After the initial period, the lock is renewed for the period specified by the locker's lockAcquireSleepInterval attribute.
Configuration
lease-database-locker element.
Example 8.4. Configuring a Lease Database Locker
<ioExceptionHandler>
<jDBCIOExceptionHandler/>
</ioExceptionHandler>
<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" lockKeepAlivePeriod="2000">
<locker>
<lease-database-locker lockAcquireSleepInterval="10000"/>
</locker>
</jdbcPersistenceAdapter>
</persistenceAdapter>Default IOException Handler
jDBCIOExceptionHandler exception handler to the configuration. The jDBCIOExceptionHandler will pause and resume the transport connectors on any I/O exception related to database access.
jDBCIOExceptionHandler is deprecated, however in Red Hat JBoss A-MQ 6.3 it is still recommended and is not deprecated. The LeaseLockerIOExceptionHandler exception handler is supported as well and it works with any persistence adapter that supports pluggable storage lockers whether or not a locker is in use.
Dealing with unsynchronized system clocks
maxAllowableDiffFromDBTime to specify the number of milliseconds by which a broker's system clock can differ from the database's before the locker automatically adds an adjustment. The default setting is zero which deactivates the adjustments.
Example 8.5. Configuring a Lease Database Locker to Adjust for Non-synchronized System Clocks
<ioExceptionHandler>
<jDBCIOExceptionHandler/>
</ioExceptionHandler>
<persistenceAdapter>
<jdbcPersistenceAdapter ... >
<locker>
<lease-database-locker maxAllowableDiffFromDBTime="1000"/>
</locker>
</jdbcPersistenceAdapter>
</persistenceAdapter>
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.