[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
why cloning messageUnit ?
Hi,
a perhaps stupide question, but I really ask me it ...
Why there Cloning messageUnit before sending message ?
For exemple in :
in engine.ClientInfo.java.notifyAboutLogin()
MessageUnitWrapper msgUnitWrapper = messageQueue.pull();
if (msgUnitWrapper == null)
break;
MessageUnit msg = msgUnitWrapper.getMessageUnitClone();
msg.qos = getUpdateQoS((String)null, msgUnitWrapper,
iMessage, numMessages);
if (Log.TRACE) Log.trace(ME, "Flushing message #" + iMessage
+ ": " + msg.qos);
MessageUnit[] arr = new MessageUnit[1];
arr[0] = msg;
// TODO: emails can also be sent to the logged off client!
cbInfo.sendUpdate(this, msgUnitWrapper,arr);
If we're pulling the message from the queue, it is no more in the queue,
so why cloning it before sending ?
I needing to understand some background because I've planning to
"trying" to hack xmlBlaster and add a behavior : when PTP persistents
messages are sending to client, erasing them from file-system if they
were sending to the destination.
Cyrille