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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(RMITest.ListenerInterface listener) Add a listener to the producer.protected voidFire a message.Methods inherited from class org.djutils.rmi.RmiObject
getRegistry, registerMethods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods 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- the host where the RMI registry resides or will be created.port- 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- the URL of the registry, e.g., "http://localhost:1099"bindingKey- 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.ProducerInterfaceAdd a listener to the producer.- Specified by:
addListenerin 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
-