|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.queuemsg.MsgQueueEntry
public abstract class MsgQueueEntry
Base class to enter xmlBlaster method invocations (messages) into an ordered queue.
Field Summary | |
---|---|
protected java.lang.String |
entryType
Which method we invoke, e.g. |
protected Global |
glob
|
protected boolean |
persistent
the flag telling if a message is persistent (opposite to transient) |
protected PriorityEnum |
priority
The message priority, see Constants.java |
protected int |
redeliverCounter
How often the entry was tried to send but failed |
protected MsgQueueEntry |
refToCloneOrigin
|
protected java.lang.Object |
returnObj
|
protected StorageId |
storageId
The queue to which this entry belongs (set in the constructors) |
protected java.lang.String |
uniqueIdString
The queue to which this entry belongs (set in the constructors) |
protected Timestamp |
uniqueIdTimestamp
The unique creation timestamp (unique in a Global of a virtual machine) |
protected boolean |
wantReturnObj
|
Constructor Summary | |
---|---|
MsgQueueEntry(Global glob,
MethodName methodName,
PriorityEnum priority,
StorageId storageId,
boolean persistent)
|
|
MsgQueueEntry(Global glob,
java.lang.String entryType,
PriorityEnum priority,
StorageId storageId,
boolean persistent)
Creates a new queue entry object. |
|
MsgQueueEntry(Global glob,
java.lang.String entryType,
PriorityEnum priority,
Timestamp timestamp,
StorageId storageId,
boolean persistent)
This constructor is for internal creation from persistence only. |
Method Summary | |
---|---|
void |
added(StorageId storageId)
Notification if this entry is added to queue |
java.lang.Object |
clone()
Returns a shallow clone. |
int |
compare(I_QueueEntry m2)
Needed for sorting the queue. |
boolean |
equals(I_QueueEntry m2)
Needed for sorting in queue |
void |
finalize()
|
java.lang.String |
getEmbeddedType()
Gets the type of the object embedded in this entry, how the object is serialized. |
abstract java.lang.String |
getKeyOid()
|
java.lang.String |
getLogId()
Return a human readable identifier for logging output. |
XBMeat |
getMeat()
For the new queues |
MethodName |
getMethodName()
|
abstract MsgUnit |
getMsgUnit()
|
int |
getPriority()
Enforced by I_QueueEntry |
PriorityEnum |
getPriorityEnum()
|
abstract SessionName |
getReceiver()
|
int |
getRedeliverCounter()
How often we tried to redeliver the message. |
XBRef |
getRef()
For the new queues |
java.lang.Object |
getReturnObj()
|
abstract SessionName |
getSender()
|
long |
getSizeInBytes()
Try to find out the approximate memory consumption of this message in RAM. |
StorageId |
getStorageId()
To which queue do i belong |
long |
getUniqueId()
The unique creation timestamp (unique in a Global of a virtual machine) Enforced by I_QueueEntry |
java.lang.Long |
getUniqueIdLong()
The unique creation timestamp (unique in a Global of a virtual machine) |
void |
incrRedeliverCounter()
Increment the counter if message delivery fails (exception during sending) We don't know if other side has processed it completely or not |
abstract boolean |
isDestroyed()
Flag which marks the entry as destroyed, you should take it from queue and ignore/discard it |
abstract boolean |
isExpired()
Flag which marks the entry as outdated |
abstract boolean |
isInternal()
|
boolean |
isPersistent()
Returns true if the entry is persistent (persistent on HD), false otherwise. |
boolean |
isStored()
|
void |
removed(StorageId storageId)
Notification if this entry is removed from queue |
void |
setGlobal(Global global)
|
void |
setPersistent(boolean persistent)
Note: Setting here is probably buggy as on reload from DB it seems to be handled as transient if embedded MsgUnit is not persistent. |
void |
setReturnObj(java.lang.Object returnObj)
Set the object to be carried as return value. |
void |
setStored(boolean stored)
Is invoked by the storage implementation with 'true' when the entry is put in a storage and with 'false' when the entry is removed from the storage. |
void |
setWantReturnObject(boolean wantReturnObj)
sets the 'wantReturnObj' flag to what you specify (overwrites the default for the implementing class). |
java.lang.String |
toString()
Nice for logging |
java.lang.String |
toXml()
Dump state of this object into XML. |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into XML. |
boolean |
wantReturnObj()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.xmlBlaster.util.queue.I_Entry |
---|
embeddedObjectToXml, getEmbeddedObject |
Field Detail |
---|
protected transient Global glob
protected transient boolean wantReturnObj
protected transient java.lang.Object returnObj
protected transient MsgQueueEntry refToCloneOrigin
protected StorageId storageId
protected int redeliverCounter
protected final Timestamp uniqueIdTimestamp
protected final PriorityEnum priority
protected boolean persistent
protected final java.lang.String entryType
protected final java.lang.String uniqueIdString
Constructor Detail |
---|
public MsgQueueEntry(Global glob, MethodName methodName, PriorityEnum priority, StorageId storageId, boolean persistent)
methodName
- use methodName as entryTypepublic MsgQueueEntry(Global glob, java.lang.String entryType, PriorityEnum priority, StorageId storageId, boolean persistent)
priority
- The message prioritystorageId
- The queue i belong toTimestamp
public MsgQueueEntry(Global glob, java.lang.String entryType, PriorityEnum priority, Timestamp timestamp, StorageId storageId, boolean persistent)
entryType
- MethodName.SUBSCRIBE etctimestamp
- The unique nano timestamp as from org.xmlBlaster.util.Timestamp or null to create one nowMethod Detail |
---|
public final void setGlobal(Global global)
public void finalize()
finalize
in class java.lang.Object
public int getPriority()
getPriority
in interface I_Entry
public final PriorityEnum getPriorityEnum()
public boolean isPersistent()
I_Entry
isPersistent
in interface I_Entry
public void setPersistent(boolean persistent)
persistent
- public long getUniqueId()
getUniqueId
in interface I_Entry
nano
- seconds
public java.lang.Long getUniqueIdLong()
nano
- secondspublic abstract boolean isExpired()
public abstract boolean isDestroyed()
public abstract boolean isInternal()
public abstract SessionName getSender()
public abstract SessionName getReceiver()
public abstract java.lang.String getKeyOid()
public final StorageId getStorageId()
public final void incrRedeliverCounter()
public final int getRedeliverCounter()
Note: Depending on the derived class implementation this information is lost on server crash (the redeliver counter is not persistent). Only MsgQueueUpdateEntry persists it.
public long getSizeInBytes()
getSizeInBytes
in interface I_Entry
public final int compare(I_QueueEntry m2)
The sorting order is priority,timestamp:
-> 5,100 - 5,98 - 5,50 - 9,3000 - 9,2500 ->
As 9 is highest priority it is the first to be taken out.
As we need to maintain the timely sequence and
id is a timestamp in (more or less) nano seconds elapsed since 1970)
the id 2500 (it is older) has precedence to the id 3000
compare
in interface I_QueueEntry
public final boolean equals(I_QueueEntry m2)
equals
in interface I_QueueEntry
public java.lang.String toXml()
public java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags
public java.lang.String toString()
toString
in class java.lang.Object
getLogId()
public java.lang.String getEmbeddedType()
I_Entry
getEmbeddedType
in interface I_Entry
public void added(StorageId storageId)
added
in interface I_Entry
I_Entry.added(StorageId)
public void removed(StorageId storageId)
removed
in interface I_Entry
storageId
- The storage idI_Entry.removed(StorageId)
public MethodName getMethodName()
getEmbeddedType()
public boolean wantReturnObj()
public void setWantReturnObject(boolean wantReturnObj)
wantReturnObj
- public java.lang.Object getReturnObj()
public void setReturnObj(java.lang.Object returnObj)
public java.lang.Object clone()
clone
in class java.lang.Object
public final java.lang.String getLogId()
getLogId
in interface I_Entry
public final void setStored(boolean stored)
I_Entry
Note that this callback is guaranteed to be called from within the queue specific synchronized block
Todo: Remove this in favour of added()/removed() (isStored() is currently only used by CacheQueueInterceptorPlugin.java) I'm not sure if this usage relies on being inside syncThis method may never throw any exception
setStored
in interface I_Entry
stored
- 'true' if the entry will be put into the storage, 'false' if it is removed.I_Entry.setStored(boolean)
public final boolean isStored()
isStored
in interface I_Entry
I_Entry.isStored()
public abstract MsgUnit getMsgUnit() throws XmlBlasterException
XmlBlasterException
public XBMeat getMeat() throws XmlBlasterException
getMeat
in interface I_Entry
XmlBlasterException
public XBRef getRef()
getRef
in interface I_Entry
|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |