org::xmlBlaster::util::queue::RamQueuePlugin Class Reference

Inheritance diagram for org::xmlBlaster::util::queue::RamQueuePlugin:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::util::queue::RamQueuePlugin:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RamQueuePlugin (org::xmlBlaster::util::Global &global, org::xmlBlaster::util::qos::storage::ClientQueueProperty &property)
 RamQueuePlugin (RamQueuePlugin &queue)
RamQueuePluginoperator= (RamQueuePlugin &queue)
virtual ~RamQueuePlugin ()
void put (MsgQueueEntry &entry)
 puts a new entry into the queue.
std::vector< EntryTypepeekWithSamePriority (long maxNumOfEntries=-1, long maxNumOfBytes=-1)
 Returns the entries with the highest priority in the queue.
long randomRemove (std::vector< EntryType >::const_iterator &start, std::vector< EntryType >::const_iterator &end)
 Deletes the entries specified in the std::vector in the argument list.
long getNumOfEntries ()
 Access the current number of entries.
long getMaxNumOfEntries ()
 Access the configured maximum number of elements for this queue.
int64_t getNumOfBytes ()
 Returns the amount of bytes currently in the queue.
int64_t getMaxNumOfBytes ()
 Access the configured capacity (maximum bytes) for this queue.
void clear ()
 Clears (removes all entries) this queue.
bool empty ()
 returns true if the queue is empty, false otherwise
std::string getType ()
 Get the name of the plugin.
std::string getVersion ()
 Get the version of the plugin.
void destroy ()
 Removes all entries and cleans up the storage, for example with a database it would remove all tables and relating database files.

Protected Attributes

std::string ME
org::xmlBlaster::util::Globalglobal_
org::xmlBlaster::util::I_Loglog_

Properties

org::xmlBlaster::util::qos::storage::ClientQueueProperty _
StorageType storage_
long numOfBytes_
org::xmlBlaster::util::thread::Mutex accessMutex_

Detailed Description

Definition at line 32 of file RamQueuePlugin.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::queue::RamQueuePlugin::RamQueuePlugin ( org::xmlBlaster::util::Global global,
org::xmlBlaster::util::qos::storage::ClientQueueProperty property 
)

Definition at line 18 of file RamQueuePlugin.cpp.

References getType(), getVersion(), org::xmlBlaster::util::I_Log::info(), log_, ME, and numOfBytes_.

org::xmlBlaster::util::queue::RamQueuePlugin::RamQueuePlugin ( RamQueuePlugin queue  ) 

Definition at line 30 of file RamQueuePlugin.cpp.

References numOfBytes_.

org::xmlBlaster::util::queue::RamQueuePlugin::~RamQueuePlugin (  )  [virtual]

Definition at line 51 of file RamQueuePlugin.cpp.

References accessMutex_, org::xmlBlaster::util::I_Log::call(), log_, ME, and storage_.


Member Function Documentation

RamQueuePlugin & org::xmlBlaster::util::queue::RamQueuePlugin::operator= ( RamQueuePlugin queue  ) 

Definition at line 41 of file RamQueuePlugin.cpp.

References accessMutex_, numOfBytes_, and storage_.

void org::xmlBlaster::util::queue::RamQueuePlugin::put ( MsgQueueEntry entry  )  [virtual]

puts a new entry into the queue.

Note that this method takes the entry pointed to by the argument and puts a reference to it into the queue. This means that you can not destroy the entry before the reference to it has been removed from the queue (which normally happens on a remove or when destroying the queue.

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 60 of file RamQueuePlugin.cpp.

References accessMutex_, org::xmlBlaster::util::I_Log::call(), org::xmlBlaster::util::I_Log::dump(), org::xmlBlaster::util::queue::MsgQueueEntry::getClone(), org::xmlBlaster::util::queue::MsgQueueEntry::getSizeInBytes(), org::xmlBlaster::util::INTERNAL_UNKNOWN, log_, ME, numOfBytes_, org::xmlBlaster::util::RESOURCE_OVERFLOW_QUEUE_BYTES, org::xmlBlaster::util::RESOURCE_OVERFLOW_QUEUE_ENTRIES, storage_, and org::xmlBlaster::util::queue::MsgQueueEntry::toXml().

vector< EntryType > org::xmlBlaster::util::queue::RamQueuePlugin::peekWithSamePriority ( long  maxNumOfEntries = -1,
long  maxNumOfBytes = -1 
) [virtual]

Returns the entries with the highest priority in the queue.

If 'maxNumOfEntries' is positive, this is the maximum number of entries to return. If maxNumOfBytes is positive, only the entries which fit into the range specified are returned. If there are no such entries, an empty std::vector is returned.

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 87 of file RamQueuePlugin.cpp.

References accessMutex_, and storage_.

long org::xmlBlaster::util::queue::RamQueuePlugin::randomRemove ( std::vector< EntryType >::const_iterator &  start,
std::vector< EntryType >::const_iterator &  end 
) [virtual]

Deletes the entries specified in the std::vector in the argument list.

If this std::vector is empty or if the queue is empty, zero (0) is returned, otherwise it returns the number of entries really deleted.

Implements org::xmlBlaster::util::queue::I_Queue.

long org::xmlBlaster::util::queue::RamQueuePlugin::getNumOfEntries (  )  [virtual]

Access the current number of entries.

Returns:
The number of entries in the queue

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 129 of file RamQueuePlugin.cpp.

References storage_.

long org::xmlBlaster::util::queue::RamQueuePlugin::getMaxNumOfEntries (  )  [virtual]

Access the configured maximum number of elements for this queue.

Returns:
The maximum number of elements in the queue

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 134 of file RamQueuePlugin.cpp.

int64_t org::xmlBlaster::util::queue::RamQueuePlugin::getNumOfBytes (  )  [virtual]

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.

Returns:
The amount of bytes currently in the queue, returns -1 on error

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 139 of file RamQueuePlugin.cpp.

References numOfBytes_.

int64_t org::xmlBlaster::util::queue::RamQueuePlugin::getMaxNumOfBytes (  )  [virtual]

Access the configured capacity (maximum bytes) for this queue.

Returns:
The maximum capacity for the queue in bytes

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 144 of file RamQueuePlugin.cpp.

void org::xmlBlaster::util::queue::RamQueuePlugin::clear (  )  [virtual]

Clears (removes all entries) this queue.

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 149 of file RamQueuePlugin.cpp.

References accessMutex_, numOfBytes_, and storage_.

bool org::xmlBlaster::util::queue::RamQueuePlugin::empty (  )  [virtual]

returns true if the queue is empty, false otherwise

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 157 of file RamQueuePlugin.cpp.

References storage_.

std::string org::xmlBlaster::util::queue::RamQueuePlugin::getType (  )  [virtual]

Get the name of the plugin.

Returns:
"RAM" I_Plugin

Implements org::xmlBlaster::util::plugin::I_Plugin.

Definition at line 117 of file RamQueuePlugin.h.

Referenced by RamQueuePlugin().

std::string org::xmlBlaster::util::queue::RamQueuePlugin::getVersion (  )  [virtual]

Get the version of the plugin.

Returns:
"1.0" I_Plugin

Implements org::xmlBlaster::util::plugin::I_Plugin.

Definition at line 124 of file RamQueuePlugin.h.

Referenced by RamQueuePlugin().

void org::xmlBlaster::util::queue::RamQueuePlugin::destroy (  )  [virtual]

Removes all entries and cleans up the storage, for example with a database it would remove all tables and relating database files.

This is an administrative task. The class instance calling destroy() is invalid after this call

Exceptions:
XmlBlasterException if failed

Implements org::xmlBlaster::util::queue::I_Queue.

Definition at line 126 of file RamQueuePlugin.h.


Member Data Documentation

std::string org::xmlBlaster::util::queue::RamQueuePlugin::ME [protected]

Definition at line 35 of file RamQueuePlugin.h.

Referenced by put(), RamQueuePlugin(), and ~RamQueuePlugin().

org::xmlBlaster::util::Global& org::xmlBlaster::util::queue::RamQueuePlugin::global_ [protected]

Definition at line 36 of file RamQueuePlugin.h.

org::xmlBlaster::util::I_Log& org::xmlBlaster::util::queue::RamQueuePlugin::log_ [protected]

Definition at line 37 of file RamQueuePlugin.h.

Referenced by put(), RamQueuePlugin(), and ~RamQueuePlugin().


Property Documentation

org::xmlBlaster::util::qos::storage::ClientQueueProperty org::xmlBlaster::util::queue::RamQueuePlugin::_ [protected]

Definition at line 38 of file RamQueuePlugin.h.

StorageType org::xmlBlaster::util::queue::RamQueuePlugin::storage_ [protected]

Definition at line 39 of file RamQueuePlugin.h.

Referenced by clear(), empty(), getNumOfEntries(), operator=(), peekWithSamePriority(), put(), and ~RamQueuePlugin().

long org::xmlBlaster::util::queue::RamQueuePlugin::numOfBytes_ [protected]

Definition at line 40 of file RamQueuePlugin.h.

Referenced by clear(), getNumOfBytes(), operator=(), put(), and RamQueuePlugin().

org::xmlBlaster::util::thread::Mutex org::xmlBlaster::util::queue::RamQueuePlugin::accessMutex_ [protected]

Definition at line 41 of file RamQueuePlugin.h.

Referenced by clear(), operator=(), peekWithSamePriority(), put(), and ~RamQueuePlugin().


The documentation for this class was generated from the following files: