xmlBlaster 2.2.0 client API

org.xmlBlaster.util.queue.ram
Class RamQueuePlugin

java.lang.Object
  extended by org.xmlBlaster.util.queue.ram.RamQueuePlugin
All Implemented Interfaces:
I_Plugin, I_Queue, I_Storage, I_StoragePlugin, I_StorageProblemNotifier

public final class RamQueuePlugin
extends java.lang.Object
implements I_Queue, I_StoragePlugin

Queueing messages in RAM only, sorted after priority and timestamp

Author:
xmlBlaster@marcelruff.info

Field Summary
 
Fields inherited from interface org.xmlBlaster.util.queue.I_Queue
IGNORE_PUT_INTERCEPTOR, USE_PUT_INTERCEPTOR
 
Constructor Summary
RamQueuePlugin()
           
 
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()
          Flush the queue
 void destroy()
          destroys silently all the resources associated to this queue.
 long embeddedObjectsToXml(java.io.OutputStream out, java.util.Properties props)
           
 long embeddedQueueObjectsToXml(java.io.OutputStream out, java.util.Properties props)
          NOTE: rename from embeddedObjectsToXml to embeddedQueueObjectsToXml as it used the map lookup and lost priority info Dump all entries of this queue to the given output stream.
 java.util.ArrayList getEntries(I_EntryFilter entryFilter)
          Gets a copy of the entries (the messages) in the queue.
 long[] getEntryReferences()
          Gets the references of the messages 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()
          Returns the number of elements in this 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()
          i
 java.lang.Object getProperties()
          Access the current queue configuration
 StorageId getStorageId()
          For verbose logging
 I_StorageSizeListener[] getStorageSizeListeners()
           
 long getSynchronizedNumOfBytes()
          Gets the number of bytes by really reading (i.e.
 java.lang.String getType()
          Enforced by I_Plugin
 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.util.ArrayList peekLowest(int numOfEntries, long numOfBytes, I_QueueEntry limitEntry, boolean leaveOne)
          Same as takeLowest but it does not remove the entries.
 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.util.ArrayList peekStartAt(int numOfEntries, long numOfBytes, I_QueueEntry firstEntryExlusive)
          Returns maximum the first num element in the queue but does not remove it from that queue (leaves it untouched).
 java.util.ArrayList peekWithLimitEntry(I_QueueEntry limitEntry)
          Deprecated.  
 java.util.ArrayList peekWithPriority(int numOfEntries, long numOfBytes, int minPrio, int maxPrio)
          Returns maximum given number of entries from the queue (none blocking).
 void put(I_QueueEntry[] msgArr, boolean ignorePutInterceptor)
          Put messages into the queue, blocks if take thread blocks synchronize
 void put(I_QueueEntry entry, boolean ignorePutInterceptor)
          Put a message into the queue, blocks if take thread blocks synchronize
 boolean registerStorageProblemListener(I_StorageProblemListener listener)
          registers a new listener to be notified.
 int remove()
          Removes the first element in the queue.
 long removeHead(I_QueueEntry toEntry)
          removes the head of the queue until (but not included) the entry specified as the argument.
 long removeNum(long numOfEntries)
          Removes max num messages.
 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.
 void removeStorageSizeListener(I_StorageSizeListener listener)
          Removes the specified listener from the queue.
 int removeTransient()
           
 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().
 void shutdown()
          Cleans up the resource.
 I_QueueEntry take()
          Currently NOT supported by I_Queue.
 java.util.ArrayList take(int numOfEntries, long numOfBytes)
          Currently NOT supported by I_Queue.
 java.util.ArrayList takeLowest(int numOfEntries, long numOfBytes, I_QueueEntry limitEntry, boolean leaveOne)
          Takes entries from the back of the queue.
 java.util.ArrayList takeSamePriority(int numOfEntries, long numOfBytes)
           
 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 of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 boolean unRegisterStorageProblemListener(I_StorageProblemListener listener)
          unregisters a listener.
 java.lang.String usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RamQueuePlugin

public RamQueuePlugin()
Method Detail

initialize

public void initialize(StorageId uniqueQueueId,
                       java.lang.Object userData)
                throws XmlBlasterException
Is called after the instance is created.

Specified by:
initialize in interface I_Queue
Parameters:
uniqueQueueId - A unique name, allowing to create a unique name for a persistent store (e.g. file name) "update:/node/heron/client/joe/2", "history:", "client:joe/2"
userData - For example a Properties object or a String[] args object passing the configuration data Here we expect a QueuePropertyBase instance
Throws:
XmlBlasterException

setProperties

public void setProperties(java.lang.Object userData)
                   throws XmlBlasterException
Allows to overwrite properties which where passed on initialize(). The properties which support hot configuration are depending on the used implementation

capacity is immutable, if you try to change a warning is logged

Specified by:
setProperties in interface I_Queue
Throws:
XmlBlasterException

getProperties

public java.lang.Object getProperties()
Access the current queue configuration

Specified by:
getProperties in interface I_Queue

isTransient

public boolean isTransient()
Specified by:
isTransient in interface I_Storage
Returns:
true for RAM based queue, false for other types like CACHE and JDBC queues

setNotifiedAboutAddOrRemove

public void setNotifiedAboutAddOrRemove(boolean notify)
Specified by:
setNotifiedAboutAddOrRemove in interface I_Queue

isNotifiedAboutAddOrRemove

public boolean isNotifiedAboutAddOrRemove()
Description copied from interface: I_Queue
Defaults to false.

Specified by:
isNotifiedAboutAddOrRemove in interface I_Queue
Returns:
true The I_QueueEntry.addedToQueue() and removedFromQueue() are invoked
false The entries are not informed

addPutListener

public void addPutListener(I_QueuePutListener l)
Description copied from interface: I_Queue
Register a listener which wants to be informed on put() events.

Only one listener is currently supported.

Specified by:
addPutListener in interface I_Queue
See Also:
I_Queue.addPutListener(I_QueuePutListener)

removePutListener

public void removePutListener(I_QueuePutListener l)
Description copied from interface: I_Queue
Remove the listener which wanted to be informed on put() events.

The currently registered listener is removed. If no listener is registered, this call is silently ignored

Specified by:
removePutListener in interface I_Queue
See Also:
I_Queue.removePutListener(I_QueuePutListener)

getEntryReferences

public long[] getEntryReferences()
                          throws XmlBlasterException
Gets the references of the messages in the queue. Note that the data which is referenced here may be changed by other threads.

Specified by:
getEntryReferences in interface I_Queue
Returns:
Array with reference numbers
Throws:
XmlBlasterException
See Also:
I_Queue.getEntryReferences()

getEntries

public java.util.ArrayList getEntries(I_EntryFilter entryFilter)
                               throws XmlBlasterException
Gets a copy of the entries (the messages) in the queue. If the queue is modified, this copy will not be affected. This method is useful for client browsing. THIS METHOD IS NOT IMPLEMENTED

Specified by:
getEntries in interface I_Queue
Parameters:
entryFilter - if not null the you can control which entries to return with the callback entryFilter.intercept(I_Entry).
Returns:
The found entries
Throws:
XmlBlasterException - always

getStorageId

public StorageId getStorageId()
For verbose logging

Specified by:
getStorageId in interface I_Storage
Returns:
For example "history_heronhello"

shutdown

public void shutdown()
Description copied from interface: I_Plugin
Cleans up the resource.

Specified by:
shutdown in interface I_Plugin
Specified by:
shutdown in interface I_Queue

isShutdown

public boolean isShutdown()
Description copied from interface: I_Storage
Performs what has to be done when the Map Plugin shuts down.

Specified by:
isShutdown in interface I_Storage

clear

public long clear()
Flush the queue

Specified by:
clear in interface I_Queue
Returns:
The number of messages erased

remove

public int remove()
           throws XmlBlasterException
Description copied from interface: I_Queue
Removes the first element in the queue. This method does not block.

Specified by:
remove in interface I_Queue
Returns:
the size in bytes of the removed elements
Throws:
XmlBlasterException - if the underlying implementation gets an exception.
See Also:
I_Queue.remove()

removeNum

public long removeNum(long numOfEntries)
               throws XmlBlasterException
Description copied from interface: I_Queue
Removes max num messages. This method does not block.

Specified by:
removeNum in interface I_Queue
Parameters:
numOfEntries - Erase num entries or less if less entries are available, -1 erases everything
Returns:
Number of entries erased
Throws:
XmlBlasterException - if the underlying implementation gets an exception.
See Also:
I_Queue#remove(long, long)

removeWithPriority

public long removeWithPriority(long numOfEntries,
                               long numOfBytes,
                               int minPriority,
                               int maxPriority)
                        throws XmlBlasterException
Description copied from interface: I_Queue
Removes max numOfEntries messages (or less depending on the numOfBytes). This method does not block.

Specified by:
removeWithPriority in interface I_Queue
Parameters:
numOfEntries - Erase num entries or less if less entries are available, -1 erases everything
numOfBytes - 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 highest
maxPriority - The higher priority (inclusive), usually 0 lowest, 9 highest
Returns:
Number of entries erased
Throws:
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.

removeTransient

public int removeTransient()
                    throws XmlBlasterException
Throws:
XmlBlasterException
See Also:
I_Queue#removeTransient()

peek

public I_QueueEntry peek()
Description copied from interface: I_Queue
Returns the first element in the queue but does not remove it from that queue (leaves it untouched). This method does not block.

Specified by:
peek in interface I_Queue
Returns:
I_QueueEntry the least element with respect to the given ordering or null if the queue is empty.
See Also:
I_Queue.peek()

peekWithPriority

public java.util.ArrayList peekWithPriority(int numOfEntries,
                                            long numOfBytes,
                                            int minPrio,
                                            int maxPrio)
                                     throws XmlBlasterException
Description copied from interface: I_Queue
Returns maximum given number of entries from the queue (none blocking).

Specified by:
peekWithPriority in interface I_Queue
Parameters:
minPrio - Extension to I_Queue: if -1 then only entries with similar priority as the first one are taken (= peekSamePriority())
numOfEntries - Access num entries, if -1 take all entries currently found
numOfBytes - 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.
maxPrio - The higher priority (inclusive), usually 0 lowest, 9 highest, <0 is not allowed
Returns:
list with I_QueueEntry, the least elements with respect to the given ordering, or size()==0
Throws:
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.
See Also:
I_Queue.peek(int, long)

peek

public java.util.ArrayList peek(int numOfEntries,
                                long numOfBytes)
                         throws XmlBlasterException
Description copied from interface: I_Queue
Returns maximum the first num element in the queue but does not remove it from that queue (leaves it untouched). This method does not block.

Specified by:
peek in interface I_Queue
Parameters:
numOfEntries - Access num entries, if -1 access all entries currently found
numOfBytes - is the maximum size in bytes of the array to return, -1 is unlimited .
Returns:
list with I_QueueEntry, the least elements with respect to the given ordering, or size()==0
Throws:
XmlBlasterException - if the underlying implementation gets an exception.
See Also:
I_Queue.peek(int, long)

peekStartAt

public java.util.ArrayList peekStartAt(int numOfEntries,
                                       long numOfBytes,
                                       I_QueueEntry firstEntryExlusive)
                                throws XmlBlasterException
Description copied from interface: I_Queue
Returns maximum the first num element in the queue but does not remove it from that queue (leaves it untouched). This method does not block.

Specified by:
peekStartAt in interface I_Queue
Parameters:
numOfEntries - Access num entries, if -1 access all entries currently found
numOfBytes - is the maximum size in bytes of the array to return, -1 is unlimited .
Returns:
list with I_QueueEntry, the least elements with respect to the given ordering, or size()==0
Throws:
XmlBlasterException - if the underlying implementation gets an exception.

peekSamePriority

public java.util.ArrayList peekSamePriority(int numOfEntries,
                                            long numOfBytes)
                                     throws XmlBlasterException
Description copied from interface: I_Queue
Returns maximum the first num element in the queue of highest priority but does not remove it from that queue (leaves it untouched). This method does not block.

Specified by:
peekSamePriority in interface I_Queue
Parameters:
numOfEntries - Access num entries, if -1 access all entries currently found
numOfBytes - 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.
Returns:
list with I_QueueEntry, the least elements with respect to the given ordering, or size()==0
Throws:
XmlBlasterException - if the underlying implementation gets an exception.
See Also:
I_Queue.peekSamePriority(int, long)

peekWithLimitEntry

public java.util.ArrayList peekWithLimitEntry(I_QueueEntry limitEntry)
                                       throws XmlBlasterException
Deprecated. 

Description copied from interface: I_Queue
It returns the entries which are higher than the entry specified in the argument list.

Specified by:
peekWithLimitEntry in interface I_Queue
Parameters:
limitEntry - 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.
Throws:
XmlBlasterException
See Also:
I_Queue.peekWithLimitEntry(I_QueueEntry)

removeWithLimitEntry

public long removeWithLimitEntry(I_QueueEntry limitEntry,
                                 boolean inclusive)
                          throws XmlBlasterException
Description copied from interface: I_Queue
It removes the entries which are higher than the entry specified in the argument list.

Specified by:
removeWithLimitEntry in interface I_Queue
Parameters:
limitEntry - 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.
Throws:
XmlBlasterException
See Also:
I_Queue.removeWithLimitEntry(I_QueueEntry, boolean)

getNumOfEntries

public long getNumOfEntries()
Description copied from interface: I_Storage
Returns the number of elements in this 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 temporary not available) it will return -1.

Specified by:
getNumOfEntries in interface I_Storage
Returns:
int the number of elements
See Also:
I_Storage.getNumOfEntries()

getNumOfPersistentEntries

public long getNumOfPersistentEntries()
i

Specified by:
getNumOfPersistentEntries in interface I_Queue
Returns:
int the number of elements currently in the queue
See Also:
I_Queue.getNumOfPersistentEntries()

getMaxNumOfEntries

public long getMaxNumOfEntries()
Description copied from interface: I_Storage
Returns the maximum number of elements for this queue

Specified by:
getMaxNumOfEntries in interface I_Storage
Returns:
The maximum number of elements in the queue
See Also:
I_Storage.getMaxNumOfEntries()

getNumOfBytes

public long getNumOfBytes()
Description copied from interface: I_Storage
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.

Specified by:
getNumOfBytes in interface I_Storage
Returns:
The number of elements currently in the queue
See Also:
I_Storage.getNumOfBytes()

getNumOfPersistentBytes

public long getNumOfPersistentBytes()
Description copied from interface: I_Queue
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.

Specified by:
getNumOfPersistentBytes in interface I_Queue
Returns:
The amount of bytes currently in the queue
See Also:
I_Queue.getNumOfPersistentBytes()

getSynchronizedNumOfBytes

public long getSynchronizedNumOfBytes()
Gets the number of bytes by really reading (i.e. by scanning the whole queue contents) the number of bytes of each single entry

See Also:
I_Storage.getNumOfBytes()

getMaxNumOfBytes

public long getMaxNumOfBytes()
Description copied from interface: I_Queue
Access the configured capacity (maximum bytes) for this queue

Specified by:
getMaxNumOfBytes in interface I_Queue
Returns:
The maximum capacity for the queue in bytes
See Also:
I_Queue.getMaxNumOfBytes()

removeRandom

public int removeRandom(I_Entry entry)
                 throws XmlBlasterException
Description copied from interface: I_Queue
Removes the given entry.

Specified by:
removeRandom in interface I_Queue
Parameters:
entry - The entry to erase.
Returns:
the number of elements erased.
Throws:
XmlBlasterException
See Also:
I_Queue.removeRandom(I_Entry)

removeRandom

public boolean[] removeRandom(I_Entry[] queueEntries)
                       throws XmlBlasterException
Description copied from interface: I_Queue
Removes the given entries.

Specified by:
removeRandom in interface I_Queue
Parameters:
queueEntries - the entries to erase.
Returns:
a boolean array of the same size as the queueEntries array. If an entry is true it means it could be removed, if false it means it could not be removed (probably already removed)
Throws:
XmlBlasterException
See Also:
I_Queue.removeRandom(I_Entry[])

take

public I_QueueEntry take()
                  throws XmlBlasterException
Currently NOT supported by I_Queue.

Throws:
XmlBlasterException

take

public java.util.ArrayList take(int numOfEntries,
                                long numOfBytes)
                         throws XmlBlasterException
Currently NOT supported by I_Queue.

Throws:
XmlBlasterException

takeSamePriority

public java.util.ArrayList takeSamePriority(int numOfEntries,
                                            long numOfBytes)
                                     throws XmlBlasterException
Throws:
XmlBlasterException

takeWithPriority

public java.util.ArrayList takeWithPriority(int numOfEntries,
                                            long numOfBytes,
                                            int minPriority,
                                            int maxPriority)
                                     throws XmlBlasterException
Description copied from interface: I_Queue
Takes given number of entries out of the queue. The ordering is first priority and secondly timestamp. This method blocks until at least one entry is found

Specified by:
takeWithPriority in interface I_Queue
Parameters:
numOfEntries - Take numOfEntries entries, if -1 take all entries currently found
numOfBytes - 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
maxPriority - The higher priority (inclusive), usually 0 lowest, 9 highest
Returns:
list with I_QueueEntry, the least elements with respect to the given ordering, or size()==0
Throws:
XmlBlasterException - in case the underlying implementation gets an exception while retrieving the element.
See Also:
I_Queue

takeLowest

public java.util.ArrayList takeLowest(int numOfEntries,
                                      long numOfBytes,
                                      I_QueueEntry limitEntry,
                                      boolean leaveOne)
                               throws XmlBlasterException
Description copied from interface: I_Queue
Takes entries from the back of the queue. It takes so many entries as the LESS restrictive of the limits specified in the argument list. If you invoke this method as: takeLowest(10, 50000L, someEntry); It will take either 10 entries or as much entries which together do not exceed 50 kB (all entries together) whichever is higher. Note that numOfEntries is exclusive. If there is no entry of lower order (lower priority and higher uniqueId) than the one specified, an empty array list is returned. A further restriction is the following: if 'leaveOne' is 'true', then at least one entry must be left on the queue. A little example: suppose the size of every entry is 100 bytes and you invoke the following: takeLowest(3, 750, null, false); then it will give back 8 entries because: numEntries would give back 3 entries. 750 bytes / 100 bytes/entry gives 7.5 entries so it would round it up to 8. Since it gives back the less restrictive it will give back 8 entries.

Specified by:
takeLowest in interface I_Queue
Parameters:
numOfEntries - inclusive, zero up to numOfEntries, if -1 up to the whole queue
numOfBytes - 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)
Returns:
the list containing all 'I_QueueEntry' entries which fit into the constrains, never null.
Throws:
XmlBlasterException
See Also:
I_Queue.takeLowest(int, long, I_QueueEntry, boolean)

peekLowest

public java.util.ArrayList peekLowest(int numOfEntries,
                                      long numOfBytes,
                                      I_QueueEntry limitEntry,
                                      boolean leaveOne)
                               throws XmlBlasterException
Description copied from interface: I_Queue
Same as takeLowest but it does not remove the entries.

Specified by:
peekLowest in interface I_Queue
Throws:
XmlBlasterException
See Also:
I_Queue.peekLowest(int, long, I_QueueEntry, boolean)

put

public void put(I_QueueEntry entry,
                boolean ignorePutInterceptor)
         throws XmlBlasterException
Put a message into the queue, blocks if take thread blocks synchronize

Specified by:
put in interface I_Queue
ignorePutInterceptor - if set to 'IGNORE_PUT_INTERCEPTOR=true' the put will not inform the QueuePutListener that a put occurred.
Throws:
XmlBlasterException - in case an error occurs. Possible causes of error can be a communication exception of the underlying implementation (jdbc, file system etc).
See Also:
I_QueuePutListener.putPre(I_QueueEntry), I_QueuePutListener.putPost(I_QueueEntry), I_Queue.put(I_QueueEntry[], boolean)

put

public void put(I_QueueEntry[] msgArr,
                boolean ignorePutInterceptor)
         throws XmlBlasterException
Put messages into the queue, blocks if take thread blocks synchronize

Specified by:
put in interface I_Queue
ignorePutInterceptor - if set to 'IGNORE_PUT_INTERCEPTOR=true' the put will not inform the QueuePutListener that a put occurred.
Throws:
XmlBlasterException - in case an error occurs. Possible causes of error can be a communication exception of the underlying implementation (jdbc, file system etc).
See Also:
I_QueuePutListener.putPre(I_QueueEntry[]), I_QueuePutListener.putPost(I_QueueEntry[])

toXml

public java.lang.String toXml()
Dump state of this object into a XML ASCII string.


toXml

public java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Specified by:
toXml in interface I_Queue
Parameters:
extraOffset - indenting of tags for nice output
Returns:
internal state of RamQueuePlugin as a XML ASCII string

removeHead

public long removeHead(I_QueueEntry toEntry)
                throws XmlBlasterException
Description copied from interface: I_Queue
removes the head of the queue until (but not included) the entry specified as the argument.

Specified by:
removeHead in interface I_Queue
Parameters:
toEntry - the entry until to remove.
Returns:
long the number of entries deleted.
Throws:
XmlBlasterException
See Also:
I_Queue.removeHead(I_QueueEntry)

destroy

public void destroy()
             throws XmlBlasterException
destroys silently all the resources associated to this queue.

Throws:
XmlBlasterException

usage

public java.lang.String usage()
Specified by:
usage in interface I_Queue
Returns:
a human readable usage help string

init

public void init(Global glob,
                 PluginInfo pluginInfo)
Enforced by I_Plugin

Specified by:
init in interface I_Plugin
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, PluginInfo)

getType

public java.lang.String getType()
Enforced by I_Plugin

Specified by:
getType in interface I_Plugin
Returns:
"RAM"

getVersion

public java.lang.String getVersion()
Enforced by I_Plugin

Specified by:
getVersion in interface I_Plugin
Returns:
"1.0"

getInfo

public PluginInfo getInfo()
Enforced by I_StoragePlugin

Specified by:
getInfo in interface I_StoragePlugin
Returns:
the pluginInfo object.

registerStorageProblemListener

public boolean registerStorageProblemListener(I_StorageProblemListener listener)
Description copied from interface: I_StorageProblemNotifier
registers a new listener to be notified. If the registration was not done (for example if the implementation only allows one listener and there is already one), then a 'false' is returned, otherwise 'true' is returned.

Specified by:
registerStorageProblemListener in interface I_StorageProblemNotifier
See Also:
I_StorageProblemNotifier.registerStorageProblemListener(I_StorageProblemListener)

unRegisterStorageProblemListener

public boolean unRegisterStorageProblemListener(I_StorageProblemListener listener)
Description copied from interface: I_StorageProblemNotifier
unregisters a listener. If there is no such listener 'false' is returned, otherwise 'true' is returned.

Specified by:
unRegisterStorageProblemListener in interface I_StorageProblemNotifier
See Also:
I_StorageProblemNotifier.unRegisterStorageProblemListener(I_StorageProblemListener)

addStorageSizeListener

public void addStorageSizeListener(I_StorageSizeListener listener)
Description copied from interface: I_Storage
Adds a storage size listener to the storage. Every time the number of storage entries changes we will fire a changed() event.

The changed() invocation is guaranteed to NOT be in any Queue specific synchronize

You can use this for example to add a threshold warning system.

Specified by:
addStorageSizeListener in interface I_Storage
Parameters:
listener - the listener to be added, adding the same listener multiple times will only remember one and fire once
See Also:
I_Storage.addStorageSizeListener(I_StorageSizeListener)

removeStorageSizeListener

public void removeStorageSizeListener(I_StorageSizeListener listener)
Description copied from interface: I_Storage
Removes the specified listener from the queue.

Specified by:
removeStorageSizeListener in interface I_Storage
Parameters:
listener - the listener to be removed. Currently only one. If you pass null, all queueSizeListeners are removed.
See Also:
I_Storage.removeStorageSizeListener(I_StorageSizeListener)

hasStorageSizeListener

public boolean hasStorageSizeListener(I_StorageSizeListener listener)
Description copied from interface: I_Storage
Checks wether the specified listener is registered.

Specified by:
hasStorageSizeListener in interface I_Storage
Parameters:
listener - the listener to check against. If you pass null it checks if at least one listener exists.
Returns:
true if the specified listener exists, false otherwise. If you passed null in the argument list it returns true if a listener exists.
See Also:
I_Storage.hasStorageSizeListener(I_StorageSizeListener)

getStorageSizeListeners

public I_StorageSizeListener[] getStorageSizeListeners()
Specified by:
getStorageSizeListeners in interface I_Storage
Returns:
the array of storage size listeners for this storage. It never returns null.
See Also:
I_Storage.getStorageSizeListeners()

embeddedQueueObjectsToXml

public long embeddedQueueObjectsToXml(java.io.OutputStream out,
                                      java.util.Properties props)
                               throws java.lang.Exception
Description copied from interface: I_Queue
NOTE: rename from embeddedObjectsToXml to embeddedQueueObjectsToXml as it used the map lookup and lost priority info Dump all entries of this queue to the given output stream. The messages are XML formatted.

Specified by:
embeddedQueueObjectsToXml in interface I_Queue
Parameters:
out - The output stream to dump the entries
props - Configuration properties, not yet specified, just pass null
Returns:
Number of entries dumped
Throws:
java.lang.Exception

embeddedObjectsToXml

public long embeddedObjectsToXml(java.io.OutputStream out,
                                 java.util.Properties props)
See Also:
I_Queue#embeddedObjectsToXml(OutputStream, Properties)

xmlBlaster 2.2.0 client API

Copyright © 1999-2014 The xmlBlaster.org contributers.