throws SystemException
  public OutputStream _invoke(String method, InputStream input,                              ResponseHandler r_handler                             )                       throws SystemException  {    try      {        CookieHolder cookie = null;        activeObjectMap.Obj self = poa.aom.get(Id);        if (poa.servant_locator != null)          {            // If the servant locator is in use, it is always responsible            // for providing the servant.            self.servant = servant = null;            cookie = new CookieHolder();          }        else if (self != null && self.isDeactiveted())          {            if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) &&                poa.servant_activator != null               )              {                // Reset the servant, forcing the subsequent activation.                servant = null;              }            else              throw new OBJECT_NOT_EXIST("Object deactivated", 0x535503ec,                                         CompletionStatus.COMPLETED_NO                                        );          }        InvokeHandler handler = getHandler(method, cookie, true);        Delegate d = null;        try          {            d = servant._get_delegate();            orb.currents.put(Thread.currentThread(), this);          }        catch (Exception ex)          {            // In some cases exception is thrown if the delegate is not set.          }        if (d instanceof servantDelegate)          {            // If the delegate is already set, check maybe we can            // reuse the existing instance.            if (((servantDelegate) d).object != this)              servant._set_delegate(new servantDelegate(servant, poa, Id));          }        else          {            servant._set_delegate(new servantDelegate(servant, poa, Id));          }        try          {            switch (manager.get_state().value())              {                case State._ACTIVE :                  return handler._invoke(method, input, r_handler);                case State._HOLDING :                  // The holding mode is implemented                  // relying on the holding capabilites of the network                  // support (if any).                  // TODO FIXME in more recent CORBA applications, the client                  // ORB can free the connection and wait for a server side                  // notification about the completed request. Implement this.                  int sleep = 5;                  int max = 500;                  // Wait till the state will be switched into some other                  // mode.                  while (manager.get_state().value() == State._HOLDING)                    {                      try                        {                          Thread.sleep(sleep);                          if (sleep < max)                            sleep = max;                        }                      catch (InterruptedException ex)                        {                        }                    }                  // Handle another mode.                  return _invoke(method, input, r_handler);                case State._DISCARDING :                  throw new TRANSIENT("Discarding mode", 0x535503e9,                                      CompletionStatus.COMPLETED_NO                                     );                case State._INACTIVE :                  throw new OBJ_ADAPTER("POA deactivated", 0x535503ea,                                        CompletionStatus.COMPLETED_NO                                       );                default :                  throw new InternalError(); // No more states.              }          }        finally          {            if (poa.servant_locator != null)              {                poa.servant_locator.postinvoke(Id, poa, method, cookie.value,                                               servant                                              );                servant = null;              }          }      }    finally      {        orb.currents.remove(Thread.currentThread());      }  }