|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.activemq.util.ServiceSupport
org.apache.activemq.broker.LockableServiceSupport
org.apache.activemq.store.jdbc.DataSourceServiceSupport
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter
public class JDBCPersistenceAdapter
A PersistenceAdapter implementation using JDBC for persistence
storage.
This persistence adapter will correctly remember prepared XA transactions,
but it will not keep track of local transaction commits so that operations
performed against the Message store are done as a single uow.
| Field Summary | |
|---|---|
protected ActiveMQMessageAudit |
audit
|
protected int |
auditRecoveryDepth
|
static long |
DEFAULT_LOCK_KEEP_ALIVE_PERIOD
|
protected boolean |
enableAudit
|
protected int |
maxAuditDepth
|
protected int |
maxProducersToAudit
|
protected int |
maxRows
|
protected LongSequenceGenerator |
sequenceGenerator
|
| Fields inherited from class org.apache.activemq.broker.LockableServiceSupport |
|---|
brokerService |
| Constructor Summary | |
|---|---|
JDBCPersistenceAdapter()
|
|
JDBCPersistenceAdapter(javax.sql.DataSource ds,
WireFormat wireFormat)
|
|
| Method Summary | |
|---|---|
void |
beginTransaction(ConnectionContext context)
|
void |
checkpoint(boolean sync)
|
void |
cleanup()
|
void |
commitAdd(ConnectionContext context,
MessageId messageId)
|
void |
commitLastAck(ConnectionContext context,
long xidLastAck,
long priority,
ActiveMQDestination destination,
java.lang.String subName,
java.lang.String clientId)
|
void |
commitRemove(ConnectionContext context,
MessageAck ack)
|
void |
commitTransaction(ConnectionContext context)
|
protected JDBCAdapter |
createAdapter()
|
Locker |
createDefaultLocker()
|
protected void |
createMessageAudit()
|
MessageStore |
createQueueMessageStore(ActiveMQQueue destination)
|
TopicMessageStore |
createTopicMessageStore(ActiveMQTopic destination)
|
TransactionStore |
createTransactionStore()
|
void |
deleteAllMessages()
|
void |
doStart()
|
void |
doStop(ServiceStopper stopper)
|
JDBCAdapter |
getAdapter()
|
int |
getAuditRecoveryDepth()
|
BrokerService |
getBrokerService()
|
int |
getCleanupPeriod()
|
Locker |
getDatabaseLocker()
Deprecated. as of 5.7.0, replaced by LockableServiceSupport.getLocker() |
java.util.Set<ActiveMQDestination> |
getDestinations()
|
java.io.File |
getDirectory()
|
long |
getLastMessageBrokerSequenceId()
|
long |
getLastProducerSequenceId(ProducerId id)
|
javax.sql.DataSource |
getLockDataSource()
|
int |
getMaxAuditDepth()
|
int |
getMaxProducersToAudit()
|
int |
getMaxRows()
|
long |
getNextSequenceId()
|
java.util.concurrent.ScheduledThreadPoolExecutor |
getScheduledThreadPoolExecutor()
|
Statements |
getStatements()
|
TransactionContext |
getTransactionContext()
|
TransactionContext |
getTransactionContext(ConnectionContext context)
|
WireFormat |
getWireFormat()
|
void |
init()
|
void |
initSequenceIdGenerator()
|
boolean |
isChangeAutoCommitAllowed()
|
boolean |
isCreateTablesOnStartup()
|
boolean |
isEnableAudit()
|
boolean |
isUseExternalMessageReferences()
|
static void |
log(java.lang.String msg,
java.sql.SQLException e)
|
void |
recover(JdbcMemoryTransactionStore jdbcMemoryTransactionStore)
|
void |
removeQueueMessageStore(ActiveMQQueue destination)
Cleanup method to remove any state associated with the given destination |
void |
removeTopicMessageStore(ActiveMQTopic destination)
Cleanup method to remove any state associated with the given destination No state retained.... |
void |
rollbackLastAck(ConnectionContext context,
byte priority,
ActiveMQDestination destination,
java.lang.String subName,
java.lang.String clientId)
|
void |
rollbackLastAck(ConnectionContext context,
JDBCTopicMessageStore store,
MessageAck ack,
java.lang.String subName,
java.lang.String clientId)
|
void |
rollbackTransaction(ConnectionContext context)
|
void |
setAdapter(JDBCAdapter adapter)
|
void |
setAuditRecoveryDepth(int auditRecoveryDepth)
|
void |
setBrokerName(java.lang.String brokerName)
|
void |
setChangeAutoCommitAllowed(boolean changeAutoCommitAllowed)
Whether the JDBC driver allows to set the auto commit. |
void |
setCleanupPeriod(int cleanupPeriod)
Sets the number of milliseconds until the database is attempted to be cleaned up for durable topics |
void |
setCreateTablesOnStartup(boolean createTablesOnStartup)
Sets whether or not tables are created on startup |
void |
setDatabaseLocker(Locker locker)
Deprecated. as of 5.7.0, replaced by LockableServiceSupport.setLocker(org.apache.activemq.broker.Locker) |
void |
setDirectory(java.io.File dir)
|
void |
setEnableAudit(boolean enableAudit)
|
void |
setLockAcquireSleepInterval(long lockAcquireSleepInterval)
Deprecated. use Locker.setLockAcquireSleepInterval(long) instead
millisecond interval between lock acquire attempts, applied to newly created DefaultDatabaseLocker
not applied if DataBaseLocker is injected. |
void |
setLockDataSource(javax.sql.DataSource dataSource)
|
void |
setMaxAuditDepth(int maxAuditDepth)
|
void |
setMaxProducersToAudit(int maxProducersToAudit)
|
void |
setMaxRows(int maxRows)
|
void |
setScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor clockDaemon)
|
void |
setStatements(Statements statements)
|
void |
setTransactionIsolation(int transactionIsolation)
set the Transaction isolation level to something other that TRANSACTION_READ_UNCOMMITTED This allowable dirty isolation level may not be achievable in clustered DB environments so a more restrictive and expensive option may be needed like TRANSACTION_REPEATABLE_READ see isolation level constants in Connection |
void |
setUsageManager(SystemUsage usageManager)
|
void |
setUseDatabaseLock(boolean useDatabaseLock)
Deprecated. use LockableServiceSupport.setUseLock(boolean) instead
Sets whether or not an exclusive database lock should be used to enable
JDBC Master/Slave. Enabled by default. |
void |
setUseExternalMessageReferences(boolean useExternalMessageReferences)
|
void |
setWireFormat(WireFormat wireFormat)
|
long |
size()
|
java.lang.String |
toString()
|
| Methods inherited from class org.apache.activemq.store.jdbc.DataSourceServiceSupport |
|---|
createDataSource, getDataDirectory, getDataDirectoryFile, getDataSource, setDataDirectory, setDataDirectoryFile, setDataSource |
| Methods inherited from class org.apache.activemq.broker.LockableServiceSupport |
|---|
getLocker, getLockKeepAlivePeriod, keepLockAlive, postStop, preStart, setBrokerService, setLocker, setLockKeepAlivePeriod, setUseLock, stopBroker |
| Methods inherited from class org.apache.activemq.util.ServiceSupport |
|---|
addServiceListener, dispose, isStarted, isStopped, isStopping, removeServiceListener, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.activemq.Service |
|---|
start, stop |
| Field Detail |
|---|
public static final long DEFAULT_LOCK_KEEP_ALIVE_PERIOD
protected int maxProducersToAudit
protected int maxAuditDepth
protected boolean enableAudit
protected int auditRecoveryDepth
protected ActiveMQMessageAudit audit
protected LongSequenceGenerator sequenceGenerator
protected int maxRows
| Constructor Detail |
|---|
public JDBCPersistenceAdapter()
public JDBCPersistenceAdapter(javax.sql.DataSource ds,
WireFormat wireFormat)
| Method Detail |
|---|
public java.util.Set<ActiveMQDestination> getDestinations()
getDestinations in interface PersistenceAdapterprotected void createMessageAudit()
public void initSequenceIdGenerator()
public MessageStore createQueueMessageStore(ActiveMQQueue destination)
throws java.io.IOException
createQueueMessageStore in interface PersistenceAdapterjava.io.IOException
public TopicMessageStore createTopicMessageStore(ActiveMQTopic destination)
throws java.io.IOException
createTopicMessageStore in interface PersistenceAdapterjava.io.IOExceptionpublic void removeQueueMessageStore(ActiveMQQueue destination)
removeQueueMessageStore in interface PersistenceAdapterdestination - Destination to forgetpublic void removeTopicMessageStore(ActiveMQTopic destination)
removeTopicMessageStore in interface PersistenceAdapterdestination - Destination to forget
public TransactionStore createTransactionStore()
throws java.io.IOException
createTransactionStore in interface PersistenceAdapterjava.io.IOException
public long getLastMessageBrokerSequenceId()
throws java.io.IOException
getLastMessageBrokerSequenceId in interface PersistenceAdapterjava.io.IOException
public long getLastProducerSequenceId(ProducerId id)
throws java.io.IOException
getLastProducerSequenceId in interface PersistenceAdapterjava.io.IOException
public void init()
throws java.lang.Exception
init in class LockableServiceSupportjava.lang.Exception
public void doStart()
throws java.lang.Exception
doStart in class ServiceSupportjava.lang.Exception
public void doStop(ServiceStopper stopper)
throws java.lang.Exception
doStop in class ServiceSupportjava.lang.Exceptionpublic void cleanup()
public void setScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor clockDaemon)
public java.util.concurrent.ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor()
getScheduledThreadPoolExecutor in class LockableServiceSupport
public JDBCAdapter getAdapter()
throws java.io.IOException
java.io.IOException
@Deprecated
public Locker getDatabaseLocker()
throws java.io.IOException
LockableServiceSupport.getLocker()
java.io.IOException
public void setDatabaseLocker(Locker locker)
throws java.io.IOException
LockableServiceSupport.setLocker(org.apache.activemq.broker.Locker)
java.io.IOException
public javax.sql.DataSource getLockDataSource()
throws java.io.IOException
java.io.IOExceptionpublic void setLockDataSource(javax.sql.DataSource dataSource)
public BrokerService getBrokerService()
protected JDBCAdapter createAdapter()
throws java.io.IOException
java.io.IOExceptionpublic void setAdapter(JDBCAdapter adapter)
public WireFormat getWireFormat()
public void setWireFormat(WireFormat wireFormat)
public TransactionContext getTransactionContext(ConnectionContext context)
throws java.io.IOException
java.io.IOException
public TransactionContext getTransactionContext()
throws java.io.IOException
java.io.IOException
public void beginTransaction(ConnectionContext context)
throws java.io.IOException
beginTransaction in interface PersistenceAdapterjava.io.IOException
public void commitTransaction(ConnectionContext context)
throws java.io.IOException
commitTransaction in interface PersistenceAdapterjava.io.IOException
public void rollbackTransaction(ConnectionContext context)
throws java.io.IOException
rollbackTransaction in interface PersistenceAdapterjava.io.IOExceptionpublic int getCleanupPeriod()
public void setCleanupPeriod(int cleanupPeriod)
public boolean isChangeAutoCommitAllowed()
public void setChangeAutoCommitAllowed(boolean changeAutoCommitAllowed)
changeAutoCommitAllowed - true to change, false to not change.
public void deleteAllMessages()
throws java.io.IOException
deleteAllMessages in interface PersistenceAdapterjava.io.IOExceptionpublic boolean isUseExternalMessageReferences()
public void setUseExternalMessageReferences(boolean useExternalMessageReferences)
public boolean isCreateTablesOnStartup()
public void setCreateTablesOnStartup(boolean createTablesOnStartup)
@Deprecated public void setUseDatabaseLock(boolean useDatabaseLock)
LockableServiceSupport.setUseLock(boolean) instead
Sets whether or not an exclusive database lock should be used to enable
JDBC Master/Slave. Enabled by default.
public static void log(java.lang.String msg,
java.sql.SQLException e)
public Statements getStatements()
public void setStatements(Statements statements)
public void setUsageManager(SystemUsage usageManager)
setUsageManager in interface PersistenceAdapterusageManager - The UsageManager that is controlling the
destination's memory usage.
public Locker createDefaultLocker()
throws java.io.IOException
createDefaultLocker in interface Lockablejava.io.IOExceptionpublic void setBrokerName(java.lang.String brokerName)
setBrokerName in interface PersistenceAdapterpublic java.lang.String toString()
toString in class DataSourceServiceSupportpublic void setDirectory(java.io.File dir)
setDirectory in interface PersistenceAdapterpublic java.io.File getDirectory()
getDirectory in interface PersistenceAdapter
public void checkpoint(boolean sync)
throws java.io.IOException
checkpoint in interface PersistenceAdapterjava.io.IOExceptionpublic long size()
size in interface PersistenceAdapter
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
throws java.io.IOException
Locker.setLockAcquireSleepInterval(long) instead
millisecond interval between lock acquire attempts, applied to newly created DefaultDatabaseLocker
not applied if DataBaseLocker is injected.
java.io.IOExceptionpublic void setTransactionIsolation(int transactionIsolation)
Connection
transactionIsolation - the isolation level to usepublic int getMaxProducersToAudit()
public void setMaxProducersToAudit(int maxProducersToAudit)
public int getMaxAuditDepth()
public void setMaxAuditDepth(int maxAuditDepth)
public boolean isEnableAudit()
public void setEnableAudit(boolean enableAudit)
public int getAuditRecoveryDepth()
public void setAuditRecoveryDepth(int auditRecoveryDepth)
public long getNextSequenceId()
public int getMaxRows()
public void setMaxRows(int maxRows)
public void recover(JdbcMemoryTransactionStore jdbcMemoryTransactionStore)
throws java.io.IOException
java.io.IOException
public void commitAdd(ConnectionContext context,
MessageId messageId)
throws java.io.IOException
java.io.IOException
public void commitRemove(ConnectionContext context,
MessageAck ack)
throws java.io.IOException
java.io.IOException
public void commitLastAck(ConnectionContext context,
long xidLastAck,
long priority,
ActiveMQDestination destination,
java.lang.String subName,
java.lang.String clientId)
throws java.io.IOException
java.io.IOException
public void rollbackLastAck(ConnectionContext context,
JDBCTopicMessageStore store,
MessageAck ack,
java.lang.String subName,
java.lang.String clientId)
throws java.io.IOException
java.io.IOException
public void rollbackLastAck(ConnectionContext context,
byte priority,
ActiveMQDestination destination,
java.lang.String subName,
java.lang.String clientId)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||