context.wm.getInitialFactHandle() );
if (context.stream.readBoolean()) {
InternalFactHandle initialFactHandle = context.wm.getInitialFactHandle();
int sinkId = context.stream.readInt();
ObjectTypeNode initialFactNode = (ObjectTypeNode) context.sinks.get( sinkId );
if (initialFactNode == null) {
// ------ START RANT ------
// The following code is as bad as it looks, but since I was so far
// unable to convince Mark that creating OTNs on demand is really bad,
// I have to continue doing it :)
EntryPointNode defaultEPNode = context.ruleBase.getRete().getEntryPointNode( EntryPoint.DEFAULT );
BuildContext buildContext = new BuildContext( context.ruleBase,
context.ruleBase.getReteooBuilder().getIdGenerator() );
buildContext.setPartitionId(RuleBasePartitionId.MAIN_PARTITION);
buildContext.setObjectTypeNodeMemoryEnabled( true );
initialFactNode = new ObjectTypeNode( sinkId,
defaultEPNode,
ClassObjectType.InitialFact_ObjectType,
buildContext );
// isn't contention something everybody loves?
context.ruleBase.lock();
try {
// Yeah, I know, because one session is being deserialized, we go and lock all of them...
initialFactNode.attach( buildContext );
} finally {
context.ruleBase.unlock();
}
// ------- END RANT -----
}