#include <coherence/net/cache/AbstractBundler.hpp>
Inherits Object.
Inherited by AbstractKeyBundler::Bundle.
Public Types | ||||
typedef spec::Handle | Handle | |||
Bundle Handle definition. | ||||
typedef spec::View | View | |||
Bundle View definition. | ||||
typedef spec::Holder | Holder | |||
Bundle Holder definition. | ||||
Public Member Functions | ||||
virtual bool | isOpen () const | |||
Check whether or not this bundle is open for adding request elements. | ||||
virtual AbstractBundler::Handle | getBundler () | |||
Return the Bundler. | ||||
virtual bool | waitForResults (bool fFirst) | |||
Wait until results of bundled requests are retrieved. | ||||
virtual void | resetStatistics () | |||
Reset statistics for this Bundle. | ||||
Static Public Attributes | ||||
static const int32_t | status_open | |||
This Bundle accepting additional items. | ||||
static const int32_t | status_pending | |||
This Bundle is closed for accepting additional items and awaiting for the execution results. | ||||
static const int32_t | status_processed | |||
This Bundle is in process of returning the result of execution back to the client. | ||||
static const int32_t | status_exception | |||
Attempt to bundle encountered and exception; the execution has to be de-optimized and performed by individual threads. | ||||
Protected Member Functions | ||||
Bundle (AbstractBundler::Handle hBundler) | ||||
Default constructor. | ||||
virtual bool | isPending () const | |||
Check whether or not this bundle is in the "pending" state - awaiting for the execution results. | ||||
virtual bool | isProcessed () const | |||
Check whether or not this bundle is in the "processed" state - ready to return the result of execution back to the client. | ||||
virtual bool | isException () const | |||
Check whether or not this bundle is in the "exception" state - bundled execution threw an exception and requests have to be un-bundled. | ||||
virtual void | setStatus (int32_t iStatus) | |||
Change the status of this Bundle. | ||||
virtual int32_t | getBundleSize () const | |||
Obtain this bundle size. | ||||
virtual bool | isMaster () const | |||
Check whether or not this is a "master" Bundle. | ||||
virtual void | setMaster () | |||
Designate this Bundle as a "master" bundle. | ||||
virtual void | ensureResults ()=0 | |||
Obtain results of the bundled requests. | ||||
virtual bool | ensureResults (bool fBurst) | |||
Obtain results of the bundled requests or ensure that the results have already been retrieved. | ||||
virtual bool | releaseThread () | |||
Release all bundle resources associated with the current thread. | ||||
virtual void | toStream (std::ostream &out) const | |||
Output a human-readable description of this Object to the given stream. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);
| ||||
virtual String::View | formatStatusName (int32_t iStatus) const | |||
Return a human readable name for the specified status value. | ||||
Protected Attributes | ||||
Volatile< int64_t > | m_cTotalBundles | |||
Statistics: the total number of times this Bundle has been used for bundled request processing. | ||||
Volatile< int64_t > | m_cTotalSize | |||
Statistics: the total size of individual requests processed by this Bundle expressed in the same units as values returned by the Bundle::getBundleSize() method. | ||||
int64_t | m_ldtStart | |||
Statistics: a timestamp of the first thread entering the bundle. | ||||
Volatile< int64_t > | m_cTotalBurstDuration | |||
Statistics: a total time duration this Bundle has spent in bundled request processing (burst). | ||||
Volatile< int64_t > | m_cTotalWaitDuration | |||
Statistics: a total time duration this Bundle has spent waiting for bundle to be ready for processing. |
Bundle | ( | AbstractBundler::Handle | hBundler | ) | [protected] |
Default constructor.
hBundler | the AbstructBundler |
Reimplemented in AbstractKeyBundler::Bundle.
virtual bool isOpen | ( | ) | const [virtual] |
Check whether or not this bundle is open for adding request elements.
virtual AbstractBundler::Handle getBundler | ( | ) | [virtual] |
Return the Bundler.
virtual bool isPending | ( | ) | const [protected, virtual] |
Check whether or not this bundle is in the "pending" state - awaiting for the execution results.
virtual bool isProcessed | ( | ) | const [protected, virtual] |
Check whether or not this bundle is in the "processed" state - ready to return the result of execution back to the client.
virtual bool isException | ( | ) | const [protected, virtual] |
Check whether or not this bundle is in the "exception" state - bundled execution threw an exception and requests have to be un-bundled.
virtual void setStatus | ( | int32_t | iStatus | ) | [protected, virtual] |
virtual int32_t getBundleSize | ( | ) | const [protected, virtual] |
Obtain this bundle size.
The return value should be expressed in the same units as the value returned by the getSizeThreshold method.
Reimplemented in AbstractKeyBundler::Bundle.
virtual bool isMaster | ( | ) | const [protected, virtual] |
virtual bool waitForResults | ( | bool | fFirst | ) | [virtual] |
Wait until results of bundled requests are retrieved.
Note that calls to this method must be externally synchronized.
fFirst | true if this is the first thread entering the bundle |
virtual void ensureResults | ( | ) | [protected, pure virtual] |
Obtain results of the bundled requests.
This method should be implemented by concrete Bundle implementations using the most efficient mechanism.
Implemented in AbstractKeyBundler::Bundle.
virtual bool ensureResults | ( | bool | fBurst | ) | [protected, virtual] |
Obtain results of the bundled requests or ensure that the results have already been retrieved.
fBurst | specifies whether or not the actual results have to be fetched on this thread; this parameter will be true for one and only one thread per bundle |
virtual bool releaseThread | ( | ) | [protected, virtual] |
Release all bundle resources associated with the current thread.
Reimplemented in AbstractKeyBundler::Bundle.
virtual String::View formatStatusName | ( | int32_t | iStatus | ) | const [protected, virtual] |
Return a human readable name for the specified status value.
iStatus | the status value to format |