Package org.djutils.event.rmi
Class RmiEventProducer
java.lang.Object
org.djutils.event.rmi.RmiEventProducer
- All Implemented Interfaces:
Serializable
,Remote
,EventProducer
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:
-
Field Summary
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionRmiEventProducer
(String host, int port, String bindingKey) Create a remote event listener and register the listener in the RMI registry.RmiEventProducer
(URL registryURL, String bindingKey) Create a remote event listener and register the listener in the RMI registry. -
Method Summary
Modifier and TypeMethodDescriptionReturn the map with the EventListener entries and the reference types.Returns the registry in which this object has been bound, e.g., to look up other objects in the registry.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
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 createdbindingKey
- String; the key under which this object will be bound in the RMI registry- Throws:
RemoteException
- when there is a problem with the RMI registryAlreadyBoundException
- when there is already another object bound to the bindingKeyNullPointerException
- when host, path, or bindingKey is nullIllegalArgumentException
- when port < 0 or port > 65535AccessException
- 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 registryAlreadyBoundException
- when there is already another object bound to the bindingKeyNullPointerException
- when registryURL or bindingKey is nullAccessException
- when there is an attempt to create a registry on a remote host
-
-
Method Details
-
getRegistry
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
Description copied from interface:EventProducer
Return the map with the EventListener entries and the reference types.- Specified by:
getEventListenerMap
in interfaceEventProducer
- Returns:
- EventListenerMap; the map with the EventListener entries and the reference types
- Throws:
RemoteException
- on network error
-