/** See ServerRequestInfo for javadocs. */
  public org.omg.IOP.ServiceContext get_reply_service_context(int id) {
    checkAccess(MID_GET_REPLY_SERVICE_CONTEXT);

    if (cachedReplyServiceContexts == null) {
      cachedReplyServiceContexts = new HashMap();
    }

    return getServiceContext(cachedReplyServiceContexts, replyMessage.getServiceContexts(), id);
  }
  /** Allows Interceptors to add service contexts to the request. */
  public void add_reply_service_context(ServiceContext service_context, boolean replace) {
    // access is currently valid for all states:
    // checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT );

    if (currentExecutionPoint == EXECUTION_POINT_ENDING) {
      ServiceContexts scs = replyMessage.getServiceContexts();

      // May be null.  If this is null, create a new one in its place.
      if (scs == null) {
        scs = new ServiceContexts(myORB);
        replyMessage.setServiceContexts(scs);
      }

      if (cachedReplyServiceContexts == null) {
        cachedReplyServiceContexts = new HashMap();
      }

      // This is during and ending point, so we now have enough
      // information to add the reply service context.
      addServiceContext(
          cachedReplyServiceContexts, scs,
          service_context, replace);
    }

    // We enqueue all adds for the following reasons:
    //
    // If we are not in the ending point then we do not yet have a
    // pointer to the ServiceContexts object so we cannot access the
    // service contexts until we get to the ending point.
    // So we enqueue this add reply service context request.
    // It is added when we do have a handle on the service contexts object.
    //
    // If we are in the ending point and we just add directly to the
    // SC container but then an interceptor raises a SystemException
    // then that add will be lost since a new container is created
    // for the SystemException response.
    //
    // Therefore we always enqueue and never dequeue (per request) so
    // that all adds will be completed.

    AddReplyServiceContextCommand addReply = new AddReplyServiceContextCommand();
    addReply.service_context = service_context;
    addReply.replace = replace;

    if (addReplyServiceContextQueue == null) {
      addReplyServiceContextQueue = new ArrayList();
    }

    // REVISIT: this does not add to the cache.
    enqueue(addReply);
  }