|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.engine.queuemsg.TopicEntry
public final class TopicEntry
Wraps an publish() message into an entry for a persistence cache.
There are two options to make this object persistent (measure on a 2GHz Intel Linux laptop with Postgres):
1. QoS and Key are stored as XML ASCII strings, the content as byte[]
This variant takes about 50 microsec to serialize (toXml()) and 380 microsec to create the object again (SAX parse).
The size for an empty content is approx. 80 bytes for a medium sized key and QoS.
2. The whole object is java.io.Serialized
This variant takes about 160 microsec to serialize and 750 microsec to deserialize.
So we have chosen the XML variant as it is faster, has no versioning problems and has smaller size
ServerEntryFactory.main(String[])
,
Serialized FormField Summary | |
---|---|
private java.lang.String |
embeddedType
|
private long |
immutableSizeInBytes
|
private static java.util.logging.Logger |
log
|
private java.lang.String |
ME
|
private MsgUnit |
msgUnit
|
private static long |
serialVersionUID
|
private Timestamp |
sortTimestamp
|
private StorageId |
storageId
|
private boolean |
stored
|
private boolean |
swapped
|
private long |
uniqueId
|
private java.lang.String |
uniqueIdStr
|
Constructor Summary | |
---|---|
TopicEntry(ServerScope glob,
MsgUnit msgUnit,
StorageId storageId)
Use this constructor if a new message object is fed by method publish(). |
|
TopicEntry(ServerScope glob,
MsgUnit msgUnit,
StorageId storageId,
java.lang.String embeddedType,
long sizeInBytes)
Used when message comes from persistence, the owning I_Map is unknown |
Method Summary | |
---|---|
void |
added(StorageId storageId)
Notification if this entry is added to storage |
java.lang.Object |
clone()
Returns a shallow clone |
void |
embeddedObjectToXml(java.io.OutputStream out,
java.util.Properties props)
Dump content to xml representation |
java.lang.String |
getContentMime()
|
java.lang.String |
getContentMimeExtended()
|
java.lang.String |
getDomain()
|
java.lang.Object |
getEmbeddedObject()
The embedded object. |
java.lang.String |
getEmbeddedType()
Gets the type of the object embedded in this entry, how the object is serialized. |
java.lang.String |
getKeyOid()
|
java.lang.String |
getLogId()
Return a human readable identifier for logging output. |
XBMeat |
getMeat()
For the new queues |
MsgKeyData |
getMsgKeyData()
|
MsgQosData |
getMsgQosData()
|
MsgUnit |
getMsgUnit()
|
int |
getPriority()
Returns a dummy only as sorting is not important in this context. |
XBRef |
getRef()
For the new queues |
long |
getSizeInBytes()
returns the size in bytes of this entry. |
Timestamp |
getSortTimestamp()
Can be used by cache implementation to implement LRU |
StorageId |
getStorageId()
Must be filled if retrieved from database. |
long |
getUniqueId()
The unique ID for this entry = getMsgQosData().getRcvTimestamp().getTimestamp() |
java.lang.String |
getUniqueIdStr()
|
boolean |
isExpired()
|
boolean |
isInternal()
|
boolean |
isPersistent()
Returns true if the entry is persistent (persistent on HD), false otherwise. |
boolean |
isStored()
|
boolean |
isSwapped()
Enforced by I_Map |
void |
isSwapped(boolean swapped)
Enforced by I_Map |
static void |
main(java.lang.String[] args)
Measure size for XML-ASCII versus java.io.Serializable persistence. |
void |
removed(StorageId storageId)
Notification if this entry is removed from storage |
void |
setMsgUnit(MsgUnit msg)
|
void |
setSortTimestamp(Timestamp timestamp)
Can be used by cache implementation to implement LRU |
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. |
java.lang.String |
toXml()
|
java.lang.String |
toXml(java.lang.String extraOffset)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.logging.Logger log
private static final long serialVersionUID
private final transient java.lang.String ME
private final transient long uniqueId
private final transient java.lang.String uniqueIdStr
private final transient java.lang.String embeddedType
private MsgUnit msgUnit
private final long immutableSizeInBytes
private transient boolean stored
private transient boolean swapped
private transient Timestamp sortTimestamp
private transient StorageId storageId
Constructor Detail |
---|
public TopicEntry(ServerScope glob, MsgUnit msgUnit, StorageId storageId) throws XmlBlasterException
msgUnit
- The raw datastorageId
- TODO
XmlBlasterException
public TopicEntry(ServerScope glob, MsgUnit msgUnit, StorageId storageId, java.lang.String embeddedType, long sizeInBytes) throws XmlBlasterException
storageId
- TODOembeddedType
- Allows you to control how to make this object persistent:sizeInByte
- The estimated size of the entry in RAM (can be totally different on HD).
If -1L it is estimated for you
XmlBlasterException
Method Detail |
---|
public int getPriority()
getPriority
in interface I_Entry
public MsgQosData getMsgQosData()
public boolean isPersistent()
I_Entry
isPersistent
in interface I_Entry
public MsgKeyData getMsgKeyData()
public MsgUnit getMsgUnit()
public java.lang.String getKeyOid()
public java.lang.String getContentMime()
public java.lang.String getContentMimeExtended()
public java.lang.String getDomain()
public void setMsgUnit(MsgUnit msg)
public long getSizeInBytes()
I_Entry
getSizeInBytes
in interface I_Entry
public long getUniqueId()
getUniqueId
in interface I_Entry
public java.lang.String getUniqueIdStr()
getUniqueIdStr
in interface I_MapEntry
public java.lang.String getLogId()
I_Entry
See the derived class for a syntax description.
getLogId
in interface I_Entry
public final boolean isInternal()
public java.lang.String getEmbeddedType()
I_Entry
getEmbeddedType
in interface I_Entry
public java.lang.Object getEmbeddedObject()
getEmbeddedObject
in interface I_Entry
public java.lang.Object clone()
clone
in class java.lang.Object
public final java.lang.String toXml()
public java.lang.String toXml(java.lang.String extraOffset)
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 boolean isExpired()
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 boolean isSwapped()
isSwapped
in interface I_MapEntry
I_Map#isSwapped()
public void isSwapped(boolean swapped)
isSwapped
in interface I_MapEntry
I_Map#isSwapped(boolean)
public final Timestamp getSortTimestamp()
getSortTimestamp
in interface I_MapEntry
public final void setSortTimestamp(Timestamp timestamp)
setSortTimestamp
in interface I_MapEntry
public final void embeddedObjectToXml(java.io.OutputStream out, java.util.Properties props) throws java.io.IOException
I_Entry
embeddedObjectToXml
in interface I_Entry
out
- The stream to dump toprops
- Control porperties
java.io.IOException
public static void main(java.lang.String[] args)
java org.xmlBlaster.engine.TopicEntryResult:
java.io.Serialized file 'TopicEntry.ser' size=1407 bytes versus XML dump=123 bytes
public XBMeat getMeat()
getMeat
in interface I_Entry
public XBRef getRef()
getRef
in interface I_Entry
public StorageId getStorageId()
I_MapEntry
getStorageId
in interface I_MapEntry
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |