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
public class RMITest.Producer extends RMIObject implements RMITest.ProducerInterface
Producer object.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.rmi.server.RemoteObject
ref
-
-
Constructor Summary
Constructors Constructor Description Producer()
Register the producer on the localhost RMI registry at the default port.Producer(String host, int port, String bindingKey)
Register this object in the RMI registry.Producer(URL registryURL, String bindingKey)
Register this object in the RMI registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(RMITest.ListenerInterface listener)
Add a listener to the producer.protected void
fire(String payload)
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 Detail
-
Producer
public Producer() throws RemoteException, AlreadyBoundException
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
public Producer(URL registryURL, String bindingKey) throws RemoteException, AlreadyBoundException
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 Detail
-
addListener
public void addListener(RMITest.ListenerInterface listener) throws RemoteException
Add a listener to the producer.- Specified by:
addListener
in interfaceRMITest.ProducerInterface
- Parameters:
listener
- the listener to add- Throws:
RemoteException
- on network error
-
fire
protected void fire(String payload) throws RemoteException
Fire a message.- Parameters:
payload
- String the payload to send to the listener- Throws:
RemoteException
- on network error
-
-