|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xmlBlaster.util.queue.cache.CacheQueueInterceptorPlugin
Implements a queue cache. Internally it utilizes a RAM queue and a JDBC queue and manages the cache logic.
| Field Summary |
| Fields inherited from interface org.xmlBlaster.util.queue.I_Queue |
IGNORE_PUT_INTERCEPTOR, USE_PUT_INTERCEPTOR |
| Fields inherited from interface org.xmlBlaster.util.queue.I_StorageProblemListener |
AVAILABLE, UNAVAILABLE, UNDEF |
| Constructor Summary | |
CacheQueueInterceptorPlugin()
|
|
| Method Summary | |
void |
addPutListener(I_QueuePutListener l)
Register a listener which wants to be informed on put() events. |
void |
addStorageSizeListener(I_StorageSizeListener listener)
Adds a storage size listener to the storage. |
long |
clear()
Clears everything and removes the queue (i.e. |
java.lang.String |
dumpEmbeddedObjectsToFile(java.lang.String fileName)
Dump all entries of this queue to a file. |
long |
embeddedObjectsToXml(java.io.OutputStream out,
java.util.Properties props)
Dump all entries of this queue to the given output stream. |
java.util.ArrayList |
getEntries(I_EntryFilter entryFilter)
Gets a copy of the entries (e.g the messages) in the queue. |
long[] |
getEntryReferences()
Gets the references of the entries in the queue. |
PluginInfo |
getInfo()
Enforced by I_StoragePlugin |
long |
getMaxNumOfBytes()
Access the configured capacity (maximum bytes) for this queue |
long |
getMaxNumOfEntries()
Returns the maximum number of elements for this queue |
long |
getNumOfBytes()
Returns the amount of bytes currently in the queue If the implementation of this interface is not able to return the correct number of entries (for example if the implementation must make a remote call to a DB which is temporarly not available) it will return -1. |
long |
getNumOfEntries()
It returns the size of the queue. |
long |
getNumOfPersistentBytes()
Returns the amount of bytes used by the persistent entries in the queue If the implementation of this interface is not able to return the correct number of entries (for example if the implementation must make a remote call to a DB which is temporarly not available) it will return -1. |
long |
getNumOfPersistentEntries()
It returns the size of persistent entries in the queue. |
I_Queue |
getPersistentQueue()
returns the persistent queue (null if no one defined) |
java.lang.Object |
getProperties()
Access the current queue configuration |
java.lang.String |
getPropertyStr()
Access the current queue configuration |
java.lang.String |
getQueueName()
Returns the unique ID of this queue as found in the database XB_ENTRIES.queueName column. |
StorageId |
getStorageId()
Returns the unique ID of this queue |
I_StorageSizeListener[] |
getStorageSizeListeners()
|
I_Queue |
getTransientQueue()
returns the transient queue (null if no one defined) |
java.lang.String |
getType()
Enforced by I_Plugin |
java.lang.String |
getUsageUrl()
|
java.lang.String |
getVersion()
Enforced by I_Plugin |
boolean |
hasStorageSizeListener(I_StorageSizeListener listener)
Checks wether the specified listener is registered. |
void |
init(Global glob,
PluginInfo pluginInfo)
Enforced by I_Plugin |
void |
initialize(StorageId uniqueQueueId,
java.lang.Object userData)
Is called after the instance is created. |
boolean |
isNotifiedAboutAddOrRemove()
Defaults to false. |
boolean |
isShutdown()
Performs what has to be done when the Map Plugin shuts down. |
boolean |
isTransient()
|
I_QueueEntry |
peek()
Returns the first element in the queue but does not remove it from that queue (leaves it untouched). |
java.util.ArrayList |
peek(int numOfEntries,
long numOfBytes)
Returns maximum the first num element in the queue but does not remove it from that queue (leaves it untouched). |
java.lang.String[] |
peekEntries(int numOfEntries)
Returns maximum the first num element in the queue but does not remove it from that queue (leaves it untouched). |
java.util.ArrayList |
peekLowest(int numOfEntries,
long numOfBytes,
I_QueueEntry limitEntry,
boolean leaveOne)
Aware: peekLowest is not implemented!! |
java.util.ArrayList |
peekSamePriority(int numOfEntries,
long numOfBytes)
Returns maximum the first num element in the queue of highest priority but does not remove it from that queue (leaves it untouched). |
java.lang.String |
peekStr()
Returns the first element in the queue but does not remove it from that queue (leaves it untouched). |
java.util.ArrayList |
peekWithLimitEntry(I_QueueEntry limitEntry)
It returns the entries which are higher than the entry specified in the argument list. |
java.util.ArrayList |
peekWithPriority(int numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
Returns maximum given number of entries from the queue (none blocking). |
void |
put(I_QueueEntry[] queueEntries,
boolean ignorePutInterceptor)
All entries are stored into the transient queue. |
void |
put(I_QueueEntry queueEntry,
boolean ignorePutInterceptor)
Puts one queue entry on top of the queue. |
boolean |
registerStorageProblemListener(I_StorageProblemListener listener)
registers a new listener to be notified. |
int |
remove()
Removes the first element in the queue This method does not block. |
long |
remove(long numOfEntries,
long numOfBytes)
Removes max num messages. |
long |
removeHead(I_QueueEntry toEntry)
removes the head of the queue until (but not included) the entry specified as the argument. |
void |
removePutListener(I_QueuePutListener l)
Remove the listener which wanted to be informed on put() events. |
int |
removeRandom(I_Entry entry)
Removes the given entry. |
boolean[] |
removeRandom(I_Entry[] queueEntries)
Removes the given entries. |
int |
removeRandom(long dataId)
Removes the given entry. |
long |
removeRandom(long[] dataIdArray)
Removes the given entries. |
void |
removeStorageSizeListener(I_StorageSizeListener listener)
Removes the specified listener from the queue. |
int |
removeTransient()
Removes all the transient entries (the ones which have the flag 'persistent' set to false. |
long |
removeWithLimitEntry(I_QueueEntry limitEntry,
boolean inclusive)
It removes the entries which are higher than the entry specified in the argument list. |
long |
removeWithPriority(long numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
Removes max numOfEntries messages (or less depending on the numOfBytes). |
void |
setNotifiedAboutAddOrRemove(boolean notify)
|
void |
setProperties(java.lang.Object userData)
Allows to overwrite properties which where passed on initialize() The properties which support hot configuration are depending on the used implementation |
void |
setUsageUrl(java.lang.String url)
|
void |
shutdown()
Shutdown the implementation, sync with data store |
void |
storageAvailable(int oldStatus)
Invoked by the I_StorageProblemNotifier when the storage becomes available again (for example on a DB when the jdbc connection is broken). |
void |
storageUnavailable(int oldStatus)
Invoked by the I_StorageProblemNotifier when the storage becomes unavailable (for example on a DB when the jdbc connection is broken). |
java.util.ArrayList |
takeLowest(int numOfEntries,
long numOfBytes,
I_QueueEntry limitEntry,
boolean leaveOne)
Aware: takeLowest for more than one entry is not implemented!! |
java.util.ArrayList |
takeWithPriority(int numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
Takes given number of entries out of the queue. |
java.lang.String |
toXml()
Dump state to XML string. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state to XML string. |
boolean |
unRegisterStorageProblemListener(I_StorageProblemListener listener)
unregisters a listener. |
int |
update(I_QueueEntry queueEntry)
Updates the given message queue entry with a new value. |
java.lang.String |
usage()
JMX help |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CacheQueueInterceptorPlugin()
| Method Detail |
public boolean isTransient()
isTransient in interface I_Storagepublic void storageUnavailable(int oldStatus)
I_StorageProblemListener
storageUnavailable in interface I_StorageProblemListeneroldStatus - the status before the storage became unavailable.I_StorageProblemListener.storageUnavailable(int)public void storageAvailable(int oldStatus)
I_StorageProblemListener
storageAvailable in interface I_StorageProblemListenerI_StorageProblemListener.storageAvailable(int)
public void initialize(StorageId uniqueQueueId,
java.lang.Object userData)
throws XmlBlasterException
initialize in interface I_QueueuniqueQueueId - A unique name, allowing to create a unique name for a persistent store (e.g. file name)userData - For example a Properties object or a String[] args object passing the configuration data
XmlBlasterExceptionI_Queue.initialize(StorageId, Object)
public void setProperties(java.lang.Object userData)
throws XmlBlasterException
I_Queue
setProperties in interface I_QueueXmlBlasterExceptionI_Queue.setProperties(Object)public java.lang.String getPropertyStr()
I_AdminQueue
getPropertyStr in interface I_AdminQueuepublic java.lang.Object getProperties()
getProperties in interface I_Queuepublic void setNotifiedAboutAddOrRemove(boolean notify)
setNotifiedAboutAddOrRemove in interface I_Queuepublic boolean isNotifiedAboutAddOrRemove()
I_Queue
isNotifiedAboutAddOrRemove in interface I_Queuepublic void addPutListener(I_QueuePutListener l)
I_Queue
addPutListener in interface I_QueueI_Queue.addPutListener(I_QueuePutListener)public void removePutListener(I_QueuePutListener l)
I_Queue
removePutListener in interface I_QueueI_Queue.removePutListener(I_QueuePutListener)public I_Queue getPersistentQueue()
public I_Queue getTransientQueue()
public long[] getEntryReferences()
throws XmlBlasterException
getEntryReferences in interface I_QueueXmlBlasterException
public java.util.ArrayList getEntries(I_EntryFilter entryFilter)
throws XmlBlasterException
I_Queue
getEntries in interface I_QueueentryFilter - if not null the you can control which entries to return
with the callback entryFilter.intercept(I_Entry).
XmlBlasterExceptionI_Queue.getEntries(I_EntryFilter)
public void put(I_QueueEntry queueEntry,
boolean ignorePutInterceptor)
throws XmlBlasterException
I_Queue
put in interface I_QueueignorePutInterceptor - if set to 'IGNORE_PUT_INTERCEPTOR=true' the put will not inform the
QueuePutListener that a put occurred.
XmlBlasterException - in case an error occurs. Possible causes of
error can be a communication exception of the underlying implementation (jdbc, file system etc).I_Queue.put(I_QueueEntry, boolean)
public void put(I_QueueEntry[] queueEntries,
boolean ignorePutInterceptor)
throws XmlBlasterException
put in interface I_QueueignorePutInterceptor - if set to 'IGNORE_PUT_INTERCEPTOR=true' the put will not inform the
QueuePutListener that a put occurred.
XmlBlasterException - in case an error occurs. Possible causes of
error can be a communication exception of the underlying implementation (jdbc, file system etc).I_Queue.put(I_QueueEntry[], boolean)public java.lang.String getQueueName()
I_AdminQueue
getQueueName in interface I_AdminQueuepublic StorageId getStorageId()
getStorageId in interface I_Storage
public java.util.ArrayList takeWithPriority(int numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
throws XmlBlasterException
I_Queue
takeWithPriority in interface I_QueuenumOfEntries - Take numOfEntries entries, if -1 take all entries currently foundnumOfBytes - so many entries are returned as not to exceed the amount specified. If the first
entry is bigger than this amount, it is returned anyway.minPriority - The lower priority (inclusive), usually 0 lowest, 9 highestmaxPriority - The higher priority (inclusive), usually 0 lowest, 9 highest
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.I_Queue.takeWithPriority(int,long,int,int)
public java.util.ArrayList peekLowest(int numOfEntries,
long numOfBytes,
I_QueueEntry limitEntry,
boolean leaveOne)
throws XmlBlasterException
peekLowest in interface I_QueueXmlBlasterExceptionI_Queue.peekLowest(int, long, I_QueueEntry, boolean)
public java.util.ArrayList takeLowest(int numOfEntries,
long numOfBytes,
I_QueueEntry limitEntry,
boolean leaveOne)
throws XmlBlasterException
takeLowest in interface I_QueuenumOfEntries - inclusive, zero up to numOfEntries, if -1 up to the whole queuenumOfBytes - inclusive, and minimum one is returned (but not if limitEntry suppress it)leaveOne - Usually set to false. (true for cache queue to never flush transient queue totally)
XmlBlasterExceptionI_Queue.takeLowest(int, long, I_QueueEntry, boolean)
public java.lang.String peekStr()
throws java.lang.Exception
I_AdminQueue
peekStr in interface I_AdminQueuejava.lang.Exception - if the underlying implementation gets an exception.
public java.lang.String[] peekEntries(int numOfEntries)
throws java.lang.Exception
I_AdminQueue
peekEntries in interface I_AdminQueuenumOfEntries - Access num entries, if -1 access all entries currently found
java.lang.Exception - if the underlying implementation gets an exception.
public I_QueueEntry peek()
throws XmlBlasterException
I_Queue
peek in interface I_QueueXmlBlasterException - if the underlying implementation gets an exception.I_Queue.peek()
public java.util.ArrayList peek(int numOfEntries,
long numOfBytes)
throws XmlBlasterException
I_Queue
peek in interface I_QueuenumOfEntries - Access num entries, if -1 access all entries currently foundnumOfBytes - is the maximum size in bytes of the array to return, -1 is unlimited .
XmlBlasterException - if the underlying implementation gets an exception.I_Queue.peek(int,long)
public java.util.ArrayList peekSamePriority(int numOfEntries,
long numOfBytes)
throws XmlBlasterException
I_Queue
peekSamePriority in interface I_QueuenumOfEntries - Access num entries, if -1 access all entries currently foundnumOfBytes - so many entries are returned as not to exceed the amount specified. If the first
entry is bigger than this amount, it is returned anyway. -1 is unlimited.
XmlBlasterException - if the underlying implementation gets an exception.I_Queue.peekSamePriority(int, long)
public java.util.ArrayList peekWithPriority(int numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
throws XmlBlasterException
I_Queue
peekWithPriority in interface I_QueuenumOfEntries - Access num entries, if -1 take all entries currently foundnumOfBytes - so many entries are returned as not to exceed the amount specified. If the first
entry is bigger than this amount, it is returned anyway.minPriority - The lower priority (inclusive), usually 0 lowest, 9 highest, <0 is not allowedmaxPriority - The higher priority (inclusive), usually 0 lowest, 9 highest, <0 is not allowed
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.I_Queue.peekWithPriority(int, long, int, int)
public java.util.ArrayList peekWithLimitEntry(I_QueueEntry limitEntry)
throws XmlBlasterException
I_Queue
peekWithLimitEntry in interface I_QueuelimitEntry - the entry which limits the peek. Only entries of higher order, i.e.
entries having a higher priority, or same priority and lower uniqueId are
returned. If entryLimit is null or no entries are higher than entryLimit,
an empty list is returned.
Note: The limitEntry does not need to be in the queue.
XmlBlasterExceptionI_Queue.peekWithLimitEntry(I_QueueEntry)
public long removeWithLimitEntry(I_QueueEntry limitEntry,
boolean inclusive)
throws XmlBlasterException
I_Queue
removeWithLimitEntry in interface I_QueuelimitEntry - the entry which limits the remove. Only entries of higher order, i.e.
entries having a higher priority, or same priority and lower uniqueId are
deleted. If entryLimit is null or no entries are higher than entryLimit,
an empty list is returned.inclusive - if 'true', then also the entry specified will be removed (if it exists). If false
the remove is exclusive, i.e. the specified entry is left in the queue.
Note: The limitEntry does not need to be in the queue.
XmlBlasterExceptionI_Queue.removeWithLimitEntry(I_QueueEntry, boolean)
public int remove()
throws XmlBlasterException
remove in interface I_QueueXmlBlasterException - if the underlying implementation gets an exception.
public long remove(long numOfEntries,
long numOfBytes)
throws XmlBlasterException
remove in interface I_QueuenumOfEntries - Erase num entries or less if less entries are available, -1 erases everythingnumOfBytes - so many entries are returned as not to exceed the amount specified. If the first
entry is bigger than this amount, it is removed anyway.
XmlBlasterException - if the underlying implementation gets an exception.
public int removeRandom(long dataId)
throws XmlBlasterException
dataId - the unique id. It must be unique within the storage area
of the implementing queue. In other words, if the underlying
implementation is on RAM, then the storage area is the JVM, that
is the queue must be unique in the same JVM. If the queue is a
jdbc, the dataId is unique in the DB used.
XmlBlasterException
public long removeRandom(long[] dataIdArray)
throws XmlBlasterException
XmlBlasterException
public int removeRandom(I_Entry entry)
throws XmlBlasterException
I_Queue
removeRandom in interface I_Queueentry - The entry to erase.
XmlBlasterExceptionI_Queue.removeRandom(I_Entry)
public final boolean[] removeRandom(I_Entry[] queueEntries)
throws XmlBlasterException
I_Queue
removeRandom in interface I_QueuequeueEntries - the entries to erase.
XmlBlasterExceptionI_Queue.removeRandom(I_Entry[])
public long removeWithPriority(long numOfEntries,
long numOfBytes,
int minPriority,
int maxPriority)
throws XmlBlasterException
I_Queue
removeWithPriority in interface I_QueuenumOfEntries - Erase num entries or less if less entries are available, -1 erases everythingnumOfBytes - so many entries are returned as not to exceed the amout specified. If the first
entry is bigger than this amount, it is returned anyway.minPriority - The lower priority (inclusive), usually 0 lowest, 9 highestmaxPriority - The higher priority (inclusive), usually 0 lowest, 9 highest
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.I_Queue.removeWithPriority(long, long, int, int)
public int removeTransient()
throws XmlBlasterException
I_AdminQueue
removeTransient in interface I_AdminQueueXmlBlasterExceptionI_Queue#removeTransient()public long getNumOfEntries()
getNumOfEntries in interface I_StorageI_Storage.getNumOfEntries()public long getNumOfPersistentEntries()
getNumOfPersistentEntries in interface I_QueueI_Queue.getNumOfPersistentEntries()public long getMaxNumOfEntries()
I_Storage
getMaxNumOfEntries in interface I_StorageI_Storage.getMaxNumOfEntries()public long getNumOfBytes()
I_Storage
getNumOfBytes in interface I_StorageI_Storage.getNumOfBytes()public long getNumOfPersistentBytes()
I_Queue
getNumOfPersistentBytes in interface I_QueueI_Queue.getNumOfPersistentBytes()public long getMaxNumOfBytes()
I_Queue
getMaxNumOfBytes in interface I_QueueI_Queue.getMaxNumOfBytes()
public int update(I_QueueEntry queueEntry)
throws XmlBlasterException
XmlBlasterExceptionpublic long clear()
clear in interface I_Queue
public long removeHead(I_QueueEntry toEntry)
throws XmlBlasterException
I_Queue
removeHead in interface I_QueuetoEntry - the entry until to remove.
XmlBlasterExceptionI_Queue.removeHead(I_QueueEntry)public void shutdown()
shutdown in interface I_Queuepublic boolean isShutdown()
I_Storage
isShutdown in interface I_Storagepublic java.lang.String usage()
usage in interface I_Queuepublic java.lang.String getUsageUrl()
getUsageUrl in interface I_AdminUsagepublic void setUsageUrl(java.lang.String url)
setUsageUrl in interface I_AdminUsagepublic final java.lang.String toXml()
I_AdminQueue
toXml in interface I_AdminQueuepublic final java.lang.String toXml(java.lang.String extraOffset)
I_Queue
toXml in interface I_QueueextraOffset - Indent the dump with given ASCII blanks
public void init(Global glob,
PluginInfo pluginInfo)
init in interface I_PluginI_Plugin.init(org.xmlBlaster.util.Global, PluginInfo)public java.lang.String getType()
getType in interface I_Pluginpublic java.lang.String getVersion()
getVersion in interface I_Pluginpublic PluginInfo getInfo()
getInfo in interface I_StoragePluginpublic boolean registerStorageProblemListener(I_StorageProblemListener listener)
I_StorageProblemNotifier
registerStorageProblemListener in interface I_StorageProblemNotifierI_StorageProblemNotifier.registerStorageProblemListener(I_StorageProblemListener)public boolean unRegisterStorageProblemListener(I_StorageProblemListener listener)
I_StorageProblemNotifier
unRegisterStorageProblemListener in interface I_StorageProblemNotifierI_StorageProblemNotifier.unRegisterStorageProblemListener(I_StorageProblemListener)public void addStorageSizeListener(I_StorageSizeListener listener)
I_Storage
addStorageSizeListener in interface I_Storagelistener - the listener to be added, adding the same listener multiple times will only remember one and fire onceI_Storage.addStorageSizeListener(I_StorageSizeListener)public void removeStorageSizeListener(I_StorageSizeListener listener)
I_Storage
removeStorageSizeListener in interface I_Storagelistener - the listener to be removed. Currently only one.
If you pass null, all queueSizeListeners are removed.I_Storage.removeStorageSizeListener(I_StorageSizeListener)public boolean hasStorageSizeListener(I_StorageSizeListener listener)
I_Storage
hasStorageSizeListener in interface I_Storagelistener - the listener to check against. If you pass null
it checks if at least one listener exists.
I_Storage.hasStorageSizeListener(I_StorageSizeListener)public I_StorageSizeListener[] getStorageSizeListeners()
getStorageSizeListeners in interface I_StorageI_Storage#getStorageSizeListeners()
public long embeddedObjectsToXml(java.io.OutputStream out,
java.util.Properties props)
throws java.lang.Exception
I_Queue
embeddedObjectsToXml in interface I_Queueout - The output stream to dump the entriesprops - Configuration properties, not yet specified, just pass null
java.lang.ExceptionI_Queue.embeddedObjectsToXml(OutputStream, Properties)
public java.lang.String dumpEmbeddedObjectsToFile(java.lang.String fileName)
throws java.lang.Exception
I_AdminQueue
dumpEmbeddedObjectsToFile in interface I_AdminQueuefileName - The file name to dump, may contain a path.
java.lang.ExceptionI_AdminQueue#dumpEmbeddedObjectsToFile(String)
|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||