qnameAsString = phaseObj.getName();
// add the list of handlers to the meta data
setupPhaseList(phaseObj, mdEntry);
} else if (obj instanceof Handler) {
Handler handlerObj = (Handler) obj;
qnameAsString = handlerObj.getName();
} else {
// TODO: will there be any other kinds of objects in the execution Chain?
qnameAsString = "NULL";
}
mdEntry.setQName(qnameAsString);
// update the index for the entry in the chain
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(logCorrelationIDString +
":writeExternal(): ***BEFORE OBJ WRITE*** executionChain entry class [" +
objClass + "] qname [" + qnameAsString + "]");
}
out.writeObject(mdEntry);
// update the index so that the index
// now indicates the next entry that
// will be attempted
nextIndex++;
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(logCorrelationIDString +
":writeExternal(): ***AFTER OBJ WRITE*** executionChain entry class [" +
objClass + "] qname [" + qnameAsString + "]");
}
} // end while entries in execution chain
// done with the entries in the execution chain
// add the end-of-list marker
MetaDataEntry lastEntry = new MetaDataEntry();
lastEntry.setClassName(MetaDataEntry.END_OF_LIST);
out.writeObject(lastEntry);
nextIndex++;
// nextIndex also gives us the number of entries
// that were actually saved as opposed to the
// number of entries in the executionChain
out.writeInt(nextIndex);
} else {
// general case: handle "null" or "empty"
out.writeBoolean(ExternalizeConstants.EMPTY_OBJECT);
if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(logCorrelationIDString + ":writeExternal(): executionChain is NULL");
}
}
//---------------------------------------------------------
// LinkedList executedPhases
//---------------------------------------------------------
// The strategy is to save some metadata about each
// member of the list and the order of the list.
// Then when the message context is re-constituted,
// try to match up with phases and handlers on the
// engine.
//
// Non-null list:
// UTF - description string
// boolean - active flag
// int - expected number of entries in the list
// objects - MetaDataEntry object per list entry
// last entry will be empty MetaDataEntry
// with MetaDataEntry.LAST_ENTRY marker
// int - adjusted number of entries in the list
// includes the last empty entry
//
// Empty list:
// UTF - description string
// boolean - empty flag
//---------------------------------------------------------
out.writeUTF("executedPhases");
if (executedPhases != null && executedPhases.size() > 0) {
// start writing data to the output stream
out.writeBoolean(ExternalizeConstants.ACTIVE_OBJECT);
out.writeInt(executedPhases.size());
// put the metadata on each member of the list into a buffer
int execNextIndex = 0;
Iterator iterator = executedPhases.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
String objClass = obj.getClass().getName();
// start the meta data entry for this object
MetaDataEntry mdEntry = new MetaDataEntry();
mdEntry.setClassName(objClass);
// get the correct object-specific name
String qnameAsString;
if (obj instanceof Phase) {
Phase inPhaseObj = (Phase) obj;
qnameAsString = inPhaseObj.getName();
// add the list of handlers to the meta data
setupPhaseList(inPhaseObj, mdEntry);
} else if (obj instanceof Handler) {
Handler inHandlerObj = (Handler) obj;
qnameAsString = inHandlerObj.getName();
} else {
// TODO: will there be any other kinds of objects in the list
qnameAsString = "NULL";
}