|
xmlBlaster 2.1.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xmlBlaster.engine.msgstore.ram.MapPlugin
public final class MapPlugin
Mapping messages in RAM only. Please refer to I_Map for Javadoc comments.
I_MapTest| Nested Class Summary | |
|---|---|
(package private) class |
MapPlugin.LruComparator
Sorts the entries in the the last recent added order (no real LRU). |
| Field Summary | |
|---|---|
private Global |
glob
|
private boolean |
isShutdown
|
private static java.util.logging.Logger |
log
|
private java.util.Set |
lruSet
|
private StorageId |
mapId
|
private java.lang.String |
ME
|
private long |
numOfPersistentEntries
|
private long |
persistentSizeInBytes
|
private PluginInfo |
pluginInfo
|
private QueuePropertyBase |
property
|
private long |
sizeInBytes
|
private java.util.Map |
storage
|
private StorageSizeListenerHelper |
storageSizeListenerHelper
|
| Constructor Summary | |
|---|---|
MapPlugin()
|
|
| Method Summary | |
|---|---|
void |
addStorageSizeListener(I_StorageSizeListener listener)
Adds a storage size listener to the storage. |
I_MapEntry |
change(I_MapEntry entry,
I_ChangeCallback callback)
|
I_MapEntry |
change(long uniqueId,
I_ChangeCallback callback)
This method is threadsafe because it makes a lookup for the updated entry within the synchronization point. |
long |
clear()
Delete all entries |
void |
destroy()
destroys all the resources associated to this queue. |
long |
embeddedObjectsToXml(java.io.OutputStream out,
java.util.Properties props)
Dump all entries of this map to the given output stream. |
I_MapEntry |
get(long uniqueId)
Lookup entry without removing. |
I_MapEntry[] |
getAll(I_EntryFilter entryFilter)
Retrieve all entries in the storage, please take care on memory consumption. |
PluginInfo |
getInfo()
Enforced by I_StoragePlugin |
long |
getMaxNumOfBytes()
returns the 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()
Returns the unique ID of this queue. |
I_StorageSizeListener[] |
getStorageSizeListeners()
|
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 uniqueMapId,
java.lang.Object userData)
Is called after the instance is created. |
boolean |
isShutdown()
Performs what has to be done when the Map Plugin shuts down. |
boolean |
isTransient()
|
static void |
main(java.lang.String[] args)
java org.xmlBlaster.engine.msgstore.ram.MapPlugin |
int |
put(I_MapEntry entry)
Adds one entry and automatically increments the reference counter. |
boolean |
registerStorageProblemListener(I_StorageProblemListener listener)
registers a new listener to be notified. |
int |
remove(I_MapEntry mapEntry)
|
int |
remove(long uniqueId)
|
I_MapEntry |
removeOldest()
Remove the oldest entry. |
void |
removeStorageSizeListener(I_StorageSizeListener listener)
Removes the specified listener from the queue. |
int |
removeTransient()
|
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 |
shutdown()
Shutdown the implementation, sync with data store, free resources |
private void |
touch(I_MapEntry entry)
|
java.lang.String |
toXml()
|
java.lang.String |
toXml(java.lang.String extraOffset)
|
boolean |
unRegisterStorageProblemListener(I_StorageProblemListener listener)
unregisters a listener. |
void |
updateCounters(I_MapEntry entry)
|
java.lang.String |
usage()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String ME
private StorageId mapId
private java.util.Map storage
private java.util.Set lruSet
private QueuePropertyBase property
private Global glob
private static java.util.logging.Logger log
private boolean isShutdown
private long sizeInBytes
private long persistentSizeInBytes
private long numOfPersistentEntries
private PluginInfo pluginInfo
private StorageSizeListenerHelper storageSizeListenerHelper
| Constructor Detail |
|---|
public MapPlugin()
| Method Detail |
|---|
public void initialize(StorageId uniqueMapId,
java.lang.Object userData)
throws XmlBlasterException
initialize in interface I_MapuniqueMapId - A unique name, allowing to create a unique name for a persistent store (e.g. file name)
"history:/node/heron/topic/userData - For example a Properties object or a String[] args object passing the configuration data
XmlBlasterExceptionI_Map.initialize(StorageId, Object)
public void setProperties(java.lang.Object userData)
throws XmlBlasterException
I_Map
setProperties in interface I_MapXmlBlasterExceptionpublic java.lang.Object getProperties()
I_Map
getProperties in interface I_Mappublic final StorageId getStorageId()
I_Storage
getStorageId in interface I_Storagepublic boolean isTransient()
isTransient in interface I_Storage
public I_MapEntry get(long uniqueId)
throws XmlBlasterException
I_Map
get in interface I_MapXmlBlasterExceptionI_Map.get(long)private void touch(I_MapEntry entry)
public I_MapEntry[] getAll(I_EntryFilter entryFilter)
throws XmlBlasterException
I_Map
getAll in interface I_MapentryFilter - null to get everything. If specified you can filter by this
callback the wanted entries.
XmlBlasterExceptionI_Map#getAll()
public int put(I_MapEntry entry)
throws XmlBlasterException
I_Map
put in interface I_MapXmlBlasterException - in case an error occurs. Possible causes of
error can be a communication exception of the underlying implementation (jdbc, file system etc).I_Map.put(I_MapEntry)
public int remove(I_MapEntry mapEntry)
throws XmlBlasterException
remove in interface I_MapXmlBlasterExceptionI_Map.remove(I_MapEntry)
public int remove(long uniqueId)
throws XmlBlasterException
remove in interface I_MapXmlBlasterExceptionI_Map.remove(long)
public int removeTransient()
throws XmlBlasterException
XmlBlasterExceptionI_Map#removeTransient()
public I_MapEntry removeOldest()
throws XmlBlasterException
I_Map
removeOldest in interface I_MapXmlBlasterExceptionI_Map.removeOldest()public long clear()
I_Map
clear in interface I_Mappublic long getNumOfEntries()
I_Storage
getNumOfEntries in interface I_StorageI_Storage.getNumOfEntries()public long getMaxNumOfEntries()
I_Storage
getMaxNumOfEntries in interface I_Storagepublic long getNumOfPersistentEntries()
getNumOfPersistentEntries in interface I_MapI_Map.getNumOfPersistentEntries()public long getNumOfBytes()
I_Storage
getNumOfBytes in interface I_StorageI_Storage.getNumOfBytes()public long getNumOfPersistentBytes()
I_Map
getNumOfPersistentBytes in interface I_MapI_Map.getNumOfPersistentBytes()public final long getMaxNumOfBytes()
I_Map
getMaxNumOfBytes in interface I_MapI_Map.getMaxNumOfBytes()public final void shutdown()
I_Map
shutdown in interface I_Mapshutdown in interface I_Pluginpublic final boolean isShutdown()
I_Storage
isShutdown in interface I_Storage
public void destroy()
throws XmlBlasterException
I_Map
destroy in interface I_MapXmlBlasterExceptionpublic java.lang.String usage()
usage in interface I_Mappublic final java.lang.String toXml()
public final java.lang.String toXml(java.lang.String extraOffset)
toXml in interface I_MapextraOffset - 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 I_MapEntry change(I_MapEntry entry,
I_ChangeCallback callback)
throws XmlBlasterException
change in interface I_Mapentry - the entry to change. This is the old entry, i.e. the entry on which the modification
has to take place by callback.
Or it is the new entry and you can pass null for callback.
IMPORTANT: This method is not threadsafe since it does not make a lookup
to get the actual entry. The specified entry could be a dirty read, in which case the
current entry would be overwritten with this dirty value. If you want to work threadsafe
you should invoke change(long, callback). That method makes a lookup within the same
synchronization point.callback - the object on which the callback method 'changeEntry' is invoked. The modification
of the object is done in that method. If you pass null, then the changeEntry is not invoked
and the processing continues with entry.
XmlBlasterException - if something goes wrong when making the change (for example if the
entry is not in the map) or if the callback throws an exception.I_Map.change(I_MapEntry, I_ChangeCallback)
public void updateCounters(I_MapEntry entry)
throws XmlBlasterException
updateCounters in interface I_Mapentry - the entry to change. This is the old entry, i.e. the entry on which the modification
has to take place by callback.
Or it is the new entry and you can pass null for callback.
IMPORTANT: This method is not threadsafe since it does not make a lookup
to get the actual entry. The specified entry could be a dirty read, in which case the
current entry would be overwritten with this dirty value. If you want to work threadsafe
you should invoke change(long, callback). That method makes a lookup within the same
synchronization point.
XmlBlasterException - if something goes wrong when making the change (for example if the
entry is not in the map) or if the callback throws an exception.I_Map.change(I_MapEntry, I_ChangeCallback)
public I_MapEntry change(long uniqueId,
I_ChangeCallback callback)
throws XmlBlasterException
I_Map
change in interface I_MapuniqueId - the uniqueId of the entry to change. This is the old entry, i.e. the entry on
which the modification has to take place.callback - the object on which the callback method 'changeEntry' is invoked. The modification
of the object is done in that method. If you pass null, then the changeEntry is not invoked
and the processing continues with entry.
XmlBlasterException - if something goes wrong when making the change (for example if the
entry is not in the map) or if the callback throws an exception.I_Map.change(long, I_ChangeCallback)
public long embeddedObjectsToXml(java.io.OutputStream out,
java.util.Properties props)
I_Map
embeddedObjectsToXml in interface I_Mapout - The output stream to dump the entriesprops - Configuration properties, not yet specified, just pass null
I_Map.embeddedObjectsToXml(OutputStream, Properties)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 static void main(java.lang.String[] args)
|
xmlBlaster 2.1.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||