Class RmiEventProducer

java.lang.Object
org.djutils.event.rmi.RmiEventProducer
All Implemented Interfaces:
Serializable, Remote, EventProducer

public class RmiEventProducer extends Object implements EventProducer, Remote
The RmiEventProducer provides a remote implementation of the eventProducer using the RMI protocol.

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html. This class was originally part of the DSOL project, see https://simulation.tudelft.nl/dsol/manual.

Author:
Peter Jacobs , Alexander Verbraeck
See Also:
  • Constructor Details

    • RmiEventProducer

      public RmiEventProducer(String host, int port, String bindingKey) throws RemoteException, AlreadyBoundException
      Create a remote event listener and register the listener in the RMI registry. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
      Parameters:
      host - String; the host where the RMI registry resides or will be created. Creation is only possible on localhost.
      port - int; the port where the RMI registry can be found or will be created
      bindingKey - String; the key under which this object will be bound in the RMI registry
      Throws:
      RemoteException - when there is a problem with the RMI registry
      AlreadyBoundException - when there is already another object bound to the bindingKey
      NullPointerException - when host, path, or bindingKey is null
      IllegalArgumentException - when port < 0 or port > 65535
      AccessException - when there is an attempt to create a registry on a remote host
    • RmiEventProducer

      public RmiEventProducer(URL registryURL, String bindingKey) throws RemoteException, AlreadyBoundException
      Create a remote event listener and register the listener in the RMI registry. When the host has not been specified in the URL, 127.0.0.1 will be used. When the port has not been specified in the URL, the default RMI port 1099 will be used. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
      Parameters:
      registryURL - URL; the URL of the registry, e.g., "http://localhost:1099" or "http://130.161.185.14:28452"
      bindingKey - String; the key under which this object will be bound in the RMI registry
      Throws:
      RemoteException - when there is a problem with the RMI registry
      AlreadyBoundException - when there is already another object bound to the bindingKey
      NullPointerException - when registryURL or bindingKey is null
      AccessException - when there is an attempt to create a registry on a remote host
  • Method Details

    • getRegistry

      public Registry getRegistry() throws RemoteException
      Returns the registry in which this object has been bound, e.g., to look up other objects in the registry.
      Returns:
      Registry; the registry in which this object has been bound
      Throws:
      RemoteException - on network error
    • getEventListenerMap

      public EventListenerMap getEventListenerMap() throws RemoteException
      Description copied from interface: EventProducer
      Return the map with the EventListener entries and the reference types.
      Specified by:
      getEventListenerMap in interface EventProducer
      Returns:
      EventListenerMap; the map with the EventListener entries and the reference types
      Throws:
      RemoteException - on network error