Class AbstractLocalDestination
- java.lang.Object
-
- net.timewalker.ffmq4.local.destination.AbstractLocalDestination
-
- All Implemented Interfaces:
javax.jms.Destination,LocalDestinationMBean,DestinationDescriptorMBean,Committable
- Direct Known Subclasses:
LocalQueue,LocalTopic
public abstract class AbstractLocalDestination extends Object implements javax.jms.Destination, LocalDestinationMBean, Committable
Base implementation for a local JMS destination
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanclosedprotected ObjectcloseLockprotected ReentrantReadWriteLockconsumersLockprotected AbstractDestinationDefinitiondestinationDefprotected List<LocalMessageConsumer>localConsumersprotected ReentrantLocktransactionLock
-
Constructor Summary
Constructors Constructor Description AbstractLocalDestination(AbstractDestinationDefinition destinationDef)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckNotClosed()protected voidcheckTransactionLock()abstract voidclose()Release destination resourcesvoidcloseTransaction()Unlock the destination for transactional updatevoidcommitChanges()Commit all changes (make sure they are really applied)intgetAutoExtendAmount()doublegetAverageCommitTime()Get the average commit time for this queue (milliseconds)intgetBlockSize()intgetInitialBlockCount()intgetJournalOutputBuffer()intgetMaxBlockCount()longgetMaxCommitTime()Get the maximum commit time for this queue (milliseconds)longgetMaxJournalSize()intgetMaxNonPersistentMessages()intgetMaxUncommittedStoreSize()intgetMaxUnflushedJournalSize()intgetMaxWriteBatchSize()longgetMinCommitTime()Get the minimum commit time for this queue (milliseconds)StringgetName()Get the destination nameintgetRegisteredConsumersCount()Get the number of currently registered consumers on this destinationintgetStorageSyncMethod()protected abstract booleanhasPendingChanges()Test if this destinations still has some uncommitted changesbooleanisClosed()protected booleanisConsumerRegistered(String consumerID)booleanisPreAllocateFiles()booleanisTemporary()booleanisUseJournal()protected LocalMessageConsumerlookupConsumer(String consumerID)protected voidnotifyCommitTime(long duration)voidopenTransaction()Lock the destination for transactional updateabstract booleanputLocked(AbstractMessage message, LocalSession session, MessageLockSet locks)Put a new message in the destination.voidregisterConsumer(LocalMessageConsumer consumer)Register a message consumer on this queueprotected abstract booleanrequiresTransactionalUpdate()Test if this destination requires transactional semantics to be updatedvoidresetStats()Reset statistics on this destinationvoidunregisterConsumer(LocalMessageConsumer consumer)Unregister a message listener-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.timewalker.ffmq4.utils.Committable
commitChanges
-
Methods inherited from interface net.timewalker.ffmq4.local.destination.LocalDestinationMBean
getSize
-
-
-
-
Field Detail
-
destinationDef
protected AbstractDestinationDefinition destinationDef
-
localConsumers
protected List<LocalMessageConsumer> localConsumers
-
consumersLock
protected ReentrantReadWriteLock consumersLock
-
transactionLock
protected ReentrantLock transactionLock
-
closed
protected boolean closed
-
closeLock
protected Object closeLock
-
-
Constructor Detail
-
AbstractLocalDestination
public AbstractLocalDestination(AbstractDestinationDefinition destinationDef)
Constructor
-
-
Method Detail
-
getName
public final String getName()
Description copied from interface:DestinationDescriptorMBeanGet the destination name- Specified by:
getNamein interfaceCommittable- Specified by:
getNamein interfaceDestinationDescriptorMBean
-
registerConsumer
public void registerConsumer(LocalMessageConsumer consumer)
Register a message consumer on this queue
-
unregisterConsumer
public void unregisterConsumer(LocalMessageConsumer consumer)
Unregister a message listener
-
isClosed
public final boolean isClosed()
- Returns:
- the closed
-
checkNotClosed
protected final void checkNotClosed() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
checkTransactionLock
protected final void checkTransactionLock() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
getRegisteredConsumersCount
public final int getRegisteredConsumersCount()
Description copied from interface:LocalDestinationMBeanGet the number of currently registered consumers on this destination- Specified by:
getRegisteredConsumersCountin interfaceLocalDestinationMBean
-
isTemporary
public final boolean isTemporary()
- Specified by:
isTemporaryin interfaceDestinationDescriptorMBean
-
getStorageSyncMethod
public int getStorageSyncMethod()
- Specified by:
getStorageSyncMethodin interfaceDestinationDescriptorMBean
-
getInitialBlockCount
public final int getInitialBlockCount()
- Specified by:
getInitialBlockCountin interfaceDestinationDescriptorMBean
-
getMaxBlockCount
public int getMaxBlockCount()
- Specified by:
getMaxBlockCountin interfaceDestinationDescriptorMBean
-
isUseJournal
public boolean isUseJournal()
- Specified by:
isUseJournalin interfaceDestinationDescriptorMBean
-
getBlockSize
public final int getBlockSize()
- Specified by:
getBlockSizein interfaceDestinationDescriptorMBean
-
getMaxNonPersistentMessages
public final int getMaxNonPersistentMessages()
- Specified by:
getMaxNonPersistentMessagesin interfaceDestinationDescriptorMBean
-
getAutoExtendAmount
public int getAutoExtendAmount()
- Specified by:
getAutoExtendAmountin interfaceDestinationDescriptorMBean
-
getJournalOutputBuffer
public int getJournalOutputBuffer()
- Specified by:
getJournalOutputBufferin interfaceDestinationDescriptorMBean
-
getMaxJournalSize
public long getMaxJournalSize()
- Specified by:
getMaxJournalSizein interfaceDestinationDescriptorMBean
-
getMaxUnflushedJournalSize
public int getMaxUnflushedJournalSize()
- Specified by:
getMaxUnflushedJournalSizein interfaceDestinationDescriptorMBean
-
getMaxUncommittedStoreSize
public int getMaxUncommittedStoreSize()
- Specified by:
getMaxUncommittedStoreSizein interfaceDestinationDescriptorMBean
-
getMaxWriteBatchSize
public int getMaxWriteBatchSize()
- Specified by:
getMaxWriteBatchSizein interfaceDestinationDescriptorMBean
-
isPreAllocateFiles
public boolean isPreAllocateFiles()
- Specified by:
isPreAllocateFilesin interfaceDestinationDescriptorMBean
-
lookupConsumer
protected final LocalMessageConsumer lookupConsumer(String consumerID)
-
isConsumerRegistered
protected final boolean isConsumerRegistered(String consumerID)
-
getMinCommitTime
public final long getMinCommitTime()
Description copied from interface:LocalDestinationMBeanGet the minimum commit time for this queue (milliseconds)- Specified by:
getMinCommitTimein interfaceLocalDestinationMBean
-
getMaxCommitTime
public final long getMaxCommitTime()
Description copied from interface:LocalDestinationMBeanGet the maximum commit time for this queue (milliseconds)- Specified by:
getMaxCommitTimein interfaceLocalDestinationMBean
-
getAverageCommitTime
public final double getAverageCommitTime()
Description copied from interface:LocalDestinationMBeanGet the average commit time for this queue (milliseconds)- Specified by:
getAverageCommitTimein interfaceLocalDestinationMBean
-
notifyCommitTime
protected final void notifyCommitTime(long duration)
-
resetStats
public void resetStats()
Description copied from interface:LocalDestinationMBeanReset statistics on this destination- Specified by:
resetStatsin interfaceLocalDestinationMBean
-
close
public abstract void close() throws javax.jms.JMSExceptionRelease destination resources- Throws:
javax.jms.JMSException
-
requiresTransactionalUpdate
protected abstract boolean requiresTransactionalUpdate()
Test if this destination requires transactional semantics to be updated- Returns:
- true if a transaction is required
-
hasPendingChanges
protected abstract boolean hasPendingChanges()
Test if this destinations still has some uncommitted changes- Returns:
- true if this destinations still has some uncommitted changes
-
openTransaction
public final void openTransaction()
Description copied from interface:CommittableLock the destination for transactional update- Specified by:
openTransactionin interfaceCommittable
-
closeTransaction
public void closeTransaction()
Description copied from interface:CommittableUnlock the destination for transactional update- Specified by:
closeTransactionin interfaceCommittable
-
commitChanges
public void commitChanges() throws javax.jms.JMSExceptionDescription copied from interface:CommittableCommit all changes (make sure they are really applied)- Specified by:
commitChangesin interfaceCommittable- Throws:
javax.jms.JMSException
-
putLocked
public abstract boolean putLocked(AbstractMessage message, LocalSession session, MessageLockSet locks) throws javax.jms.JMSException
Put a new message in the destination. The message is locked and the lock registered in the provided lock set- Returns:
- true if a commit is required to ensure data safety
- Throws:
javax.jms.JMSException
-
-