Package org.djutils.rmi
Class RMITest.Producer
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.djutils.rmi.RmiObject
org.djutils.rmi.RMITest.Producer
- All Implemented Interfaces:
Serializable
,Remote
,RMITest.ProducerInterface
- Enclosing class:
- RMITest
Producer object.
- See Also:
-
Field Summary
Fields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(RMITest.ListenerInterface listener) Add a listener to the producer.protected void
Fire a message.Methods inherited from class org.djutils.rmi.RmiObject
getRegistry, register
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
-
Constructor Details
-
Producer
Register the producer on the localhost RMI registry at the default port.- Throws:
RemoteException
- on network errorAlreadyBoundException
- on error
-
Producer
public Producer(String host, int port, String bindingKey) throws RemoteException, AlreadyBoundException Register this object in the RMI registry.- Parameters:
host
- String; the host where the RMI registry resides or will be created.port
- int; the port where the RMI registry can be found or will be createdbindingKey
- 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
-
Producer
Register this object in the RMI registry.- Parameters:
registryURL
- URL; the URL of the registry, e.g., "http://localhost:1099"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
-
addListener
Description copied from interface:RMITest.ProducerInterface
Add a listener to the producer.- Specified by:
addListener
in interfaceRMITest.ProducerInterface
- Parameters:
listener
- the listener to add- Throws:
RemoteException
- on network error
-
fire
Fire a message.- Parameters:
payload
- String the payload to send to the listener- Throws:
RemoteException
- on network error
-