public static ObjectTypeNode attachObjectTypeNode(BuildContext context, ObjectType objectType) { final InternalRuleBase ruleBase = context.getRuleBase(); ruleBase.readLock(); try { InternalWorkingMemory[] wms = context.getWorkingMemories(); EntryPointNode epn = ruleBase.getRete().getEntryPointNode(context.getCurrentEntryPoint()); if (epn == null) { epn = new EntryPointNode(context.getNextId(), ruleBase.getRete(), context); if (wms.length > 0) { epn.attach(wms); } else { epn.attach(); } } ObjectTypeNode otn = new ObjectTypeNode(context.getNextId(), epn, objectType, context); long expirationOffset = getExpiratioOffsetForType(context, objectType); otn.setExpirationOffset(expirationOffset); if (wms.length > 0) { otn.attach(wms); } else { otn.attach(); } return otn; } finally { ruleBase.readUnlock(); } }