|
xmlBlaster 1.6.2 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xmlBlaster.engine.queuemsg.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 Form| Field 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 boolean |
stored
|
private boolean |
swapped
|
private long |
uniqueId
|
private java.lang.String |
uniqueIdStr
|
| Constructor Summary | |
TopicEntry(ServerScope glob,
MsgUnit msgUnit)
Use this constructor if a new message object is fed by method publish(). |
|
TopicEntry(ServerScope glob,
MsgUnit msgUnit,
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. |
MsgKeyData |
getMsgKeyData()
|
MsgQosData |
getMsgQosData()
|
MsgUnit |
getMsgUnit()
|
int |
getPriority()
Returns a dummy only as sorting is not important in this context. |
long |
getSizeInBytes()
returns the size in bytes of this entry. |
Timestamp |
getSortTimestamp()
Can be used by cache implementation to implement LRU |
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
| Constructor Detail |
public TopicEntry(ServerScope glob,
MsgUnit msgUnit)
throws XmlBlasterException
msgUnit - The raw data
public TopicEntry(ServerScope glob,
MsgUnit msgUnit,
java.lang.String embeddedType,
long sizeInBytes)
throws XmlBlasterException
embeddedType - Allows you to control how to make this object persistent:| Method Detail |
public int getPriority()
getPriority in interface I_Entrypublic MsgQosData getMsgQosData()
public boolean isPersistent()
I_Entry
isPersistent in interface I_Entrypublic 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_Entrypublic long getUniqueId()
getUniqueId in interface I_Entrypublic java.lang.String getUniqueIdStr()
getUniqueIdStr in interface I_MapEntrypublic java.lang.String getLogId()
I_EntrySee the derived class for a syntax description.
getLogId in interface I_Entrypublic final boolean isInternal()
public java.lang.String getEmbeddedType()
I_Entry
getEmbeddedType in interface I_Entrypublic java.lang.Object getEmbeddedObject()
getEmbeddedObject in interface I_Entrypublic java.lang.Object clone()
public final java.lang.String toXml()
public java.lang.String toXml(java.lang.String extraOffset)
public void added(StorageId storageId)
added in interface I_EntryI_Entry.added(StorageId)public void removed(StorageId storageId)
removed in interface I_EntrystorageId - The storage idI_Entry.removed(StorageId)public boolean isExpired()
public final void setStored(boolean stored)
I_EntryNote 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_Entrystored - '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_EntryI_Entry.isStored()public boolean isSwapped()
isSwapped in interface I_MapEntryI_Map#isSwapped()public void isSwapped(boolean swapped)
isSwapped in interface I_MapEntryI_Map#isSwapped(boolean)public final Timestamp getSortTimestamp()
getSortTimestamp in interface I_MapEntrypublic 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_Entryout - The stream to dump toprops - Control porperties
java.io.IOExceptionpublic 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
|
xmlBlaster 1.6.2 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||