Class RefreshRegistry

java.lang.Object
org.apache.hadoop.ipc.RefreshRegistry

@Unstable public class RefreshRegistry extends Object
Used to registry custom methods to refresh at runtime. Each identifier maps to one or more RefreshHandlers.
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Constructor Details

    • RefreshRegistry

      public RefreshRegistry()
  • Method Details

    • defaultRegistry

      public static RefreshRegistry defaultRegistry()
    • register

      public void register(String identifier, RefreshHandler handler)
      Registers an object as a handler for a given identity. Note: will prevent handler from being GC'd, object should unregister itself when done
      Parameters:
      identifier - a unique identifier for this resource, such as org.apache.hadoop.blacklist
      handler - the object to register
    • unregister

      public boolean unregister(String identifier, RefreshHandler handler)
      Remove the registered object for a given identity.
      Parameters:
      identifier - the resource to unregister
      handler - input handler.
      Returns:
      the true if removed
    • unregisterAll

      public void unregisterAll(String identifier)
    • dispatch

      public Collection<RefreshResponse> dispatch(String identifier, String[] args)
      Lookup the responsible handler and return its result. This should be called by the RPC server when it gets a refresh request.
      Parameters:
      identifier - the resource to refresh
      args - the arguments to pass on, not including the program name
      Returns:
      the response from the appropriate handler
      Throws:
      IllegalArgumentException - on invalid identifier