예제 #1
0
    public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException {

      InternalFactHandle factHandle = inCtx.handles.get(inCtx.readInt());

      String entryPointId = inCtx.readUTF();
      EntryPointNode epn =
          ((ReteooRuleBase) inCtx.wm.getRuleBase())
              .getRete()
              .getEntryPointNode(new EntryPoint(entryPointId));

      String className = inCtx.readUTF();
      Class<?> cls =
          ((ReteooRuleBase) inCtx.wm.getRuleBase()).getRootClassLoader().loadClass(className);
      ObjectTypeNode otn = epn.getObjectTypeNodes().get(new ClassObjectType(cls));

      long nextTimeStamp = inCtx.readLong();

      TimerService clock = inCtx.wm.getTimerService();

      JobContext jobctx =
          new ExpireJobContext(new WorkingMemoryReteExpireAction(factHandle, otn), inCtx.wm);
      JobHandle handle =
          clock.scheduleJob(job, jobctx, new PointInTimeTrigger(nextTimeStamp, null, null));
      jobctx.setJobHandle(handle);
    }
예제 #2
0
  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();
    }
  }