Class DefaultRegistry

java.lang.Object
org.tentackle.trip.impl.DefaultRegistry
All Implemented Interfaces:
Registry, Remote, RemoteLookup

public class DefaultRegistry extends Object implements Registry
The default implementation of Registry.

The registry is thread-safe.

  • Constructor Details

    • DefaultRegistry

      public DefaultRegistry()
      Creates a new registry.
  • Method Details

    • register

      public <T extends Remote> RemoteDelegate<T> register(T remoteObject, String name)
      Description copied from interface: Registry
      Registers a remote object with a symbolic name.
      Specified by:
      register in interface Registry
      Parameters:
      remoteObject - the remote object to register
      name - the symbolic name of the remote delegate
      Returns:
      the remote delegate
    • register

      public <T extends Remote> RemoteDelegate<T> register(T remoteObject)
      Description copied from interface: Registry
      Registers a remote object w/o a symbolic name.
      Specified by:
      register in interface Registry
      Parameters:
      remoteObject - the remote object to register
      Returns:
      the remote delegate
    • unregister

      public <T extends Remote> RemoteDelegate<T> unregister(UUID id)
      Description copied from interface: Registry
      Unregisters a remote delegate by its unique ID.
      Specified by:
      unregister in interface Registry
      Type Parameters:
      T - the type of the target object
      Parameters:
      id - the unique ID of the remote delegate to unregister
      Returns:
      the remote delegate if found, null otherwise
    • unregister

      public <T extends Remote> RemoteDelegate<T> unregister(String name)
      Description copied from interface: Registry
      Unregisters a remote delegate by its symbolic name.
      Specified by:
      unregister in interface Registry
      Type Parameters:
      T - the type of the target object
      Parameters:
      name - the symbolic name of the remote delegate to unregister
      Returns:
      the remote delegate if found, null otherwise
    • lookup

      public <T extends Remote> RemoteDelegate<T> lookup(UUID id)
      Description copied from interface: Registry
      Looks up a remote delegate by its unique ID.
      Specified by:
      lookup in interface Registry
      Type Parameters:
      T - the type of the target object
      Parameters:
      id - the unique ID of the remote delegate to look up
      Returns:
      the remote delegate if found, null otherwise
    • lookup

      public UUID lookup(String name)
      Description copied from interface: RemoteLookup
      Looks up the unique ID of a remote delegate by its symbolic name.
      Specified by:
      lookup in interface RemoteLookup
      Parameters:
      name - the symbolic name of the remote delegate to look up
      Returns:
      the unique ID of the remote delegate if found, null otherwise
    • lookup

      public UUID lookup(Remote remoteObject)
      Description copied from interface: Registry
      Looks up the unique ID of a remote object.
      Locates the remote delegate of a remote object and returns its unique ID.
      Specified by:
      lookup in interface Registry
      Parameters:
      remoteObject - the target object of the remote delegate to look up
      Returns:
      the unique ID of the remote delegate if found, null otherwise
    • createRemoteDelegate

      protected <T extends Remote> RemoteDelegate<T> createRemoteDelegate(UUID remoteId, T remoteObject, IndexedMethodCache methodCache)
      Creates a new RemoteDelegate.
      Type Parameters:
      T - the type of the target object
      Parameters:
      remoteId - the ID of the remote delegate
      remoteObject - the target object of the remote delegate
      methodCache - the method cache for the target object (must be thread-safe!)
      Returns:
      the new remote delegate