Exemplo n.º 1
0
  /**
   * Registers the request to begin a federation save. Note that the save isn't actually started in
   * this handler, the request is just checked to see if everything is OK and the message is sent
   * out. The actual recording of the save point (in the SaveManager) is done in the incoming
   * handler.
   */
  public void process(MessageContext context) throws Exception {
    // basic validity checks
    lrcState.checkJoined();
    lrcState.checkSave();
    lrcState.checkRestore();

    // get the request and details
    SaveRequest request = context.getRequest(SaveRequest.class, this);
    String label = request.getLabel();

    // make sure we haven't got a null handle
    if (label == null) throw new RTIinternalError("Save label was null");

    if (logger.isDebugEnabled()) {
      String time = request.isTimestamped() ? "@" + request.getTimestamp() : "@now";
      logger.debug("REQUEST Start federation SAVE with label [" + label + "] " + time);
    }

    // if a timestamp is present, validate it
    if (request.isTimestamped() && request.getTimestamp() < timeStatus().getCurrentTime())
      throw new JFederationTimeAlreadyPassed("Time " + request.getTimestamp() + " has passed");

    // pass the request on to the federation
    connection.broadcast(request);

    if (logger.isInfoEnabled())
      logger.info("Broadcast request to start federation save with label [" + label + "]");

    context.success();
  }
  public void process(MessageContext context) throws Exception {
    DiscoverObject request = context.getRequest(DiscoverObject.class, this);
    int objectHandle = request.getObjectHandle();
    int classHandle = request.getClassHandle();
    String objectName = request.getObjectName();

    if (logger.isTraceEnabled()) {
      logger.trace(
          "CALLBACK discoverObjectInstance(object="
              + objectHandle
              + ",class="
              + classHandle
              + ",name="
              + objectName
              + ")");
    }

    // do the callback
    if (isStandard()) hla13().discoverObjectInstance(objectHandle, classHandle, objectName);
    else java1().discoverObjectInstance(objectHandle, classHandle, objectName);

    context.success();
  }