Package com.zeroc.Ice

Interface ServantLocator


public interface ServantLocator
An application-provided class that an object adapter uses to locate servants.

Servant locators are provided for backward compatibility with earlier versions of Ice. You should consider using a default servant instead (see ObjectAdapter.addDefaultServant(com.zeroc.Ice.Object, java.lang.String)). For more advanced use cases, you can create a middleware (see ObjectAdapter.use(java.util.function.Function<com.zeroc.Ice.Object, com.zeroc.Ice.Object>)).

See Also:
  • Method Details

    • locate

      Asks this servant locator to find and return a servant.

      The caller (the object adapter) does not insert the returned servant into its Active Servant Map. This must be done by the servant locator implementation, if this is desired.

      If you call locate from your own code, you must also call finished(com.zeroc.Ice.Current, com.zeroc.Ice.Object, java.lang.Object) when you have finished using the servant, provided that locate returned a non-null servant.

      Parameters:
      curr - information about the incoming request for which a servant is required
      Returns:
      an instance of ServantLocator.LocateResult containing the located servant, or null if no suitable servant was found
      Throws:
      UserException - The implementation can throw any exception, including UserException. The Ice runtime will marshal this exception in the response.
      See Also:
    • finished

      void finished(Current curr, Object servant, Object cookie) throws UserException
      Notifies this servant locator that the dispatch on the servant returned by locate(com.zeroc.Ice.Current) is complete. The object adapter calls this method only when locate(com.zeroc.Ice.Current) returns a non-null servant.
      Parameters:
      curr - information about the incoming request for which a servant was located
      servant - the servant that was returned by locate(com.zeroc.Ice.Current)
      cookie - the cookie that was returned by locate(com.zeroc.Ice.Current)
      Throws:
      UserException - The implementation can throw any exception, including UserException. The Ice runtime will marshal this exception in the response. If both the dispatch and finished throw an exception, the exception thrown by finished prevails and is marshaled back to the client.
    • deactivate

      void deactivate(String category)
      Notifies this servant locator that the object adapter in which it's installed is being deactivated.
      Parameters:
      category - the category with which this servant locator was registered
      See Also: