Package org.djutils.demo.rmi
Class Producer
java.lang.Object
java.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.djutils.rmi.RMIObject
org.djutils.demo.rmi.Producer
- All Implemented Interfaces:
Serializable
,Remote
,ProducerInterface
public class Producer extends org.djutils.rmi.RMIObject implements ProducerInterface
Producer.java.
Copyright (c) 2019-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Producer()
Register the producer on the localhost RMI registry at the default port. -
Method Summary
Modifier and Type Method Description void
addListener(ListenerInterface listener)
Add a listener to the producer.protected void
commands()
create a small interactive application.protected void
fire(String payload)
Fire a message.static void
main(String[] args)
System.exit(...) calls help to shut down RMI / socket thread that might wait for a timeout.Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
-
Constructor Details
-
Producer
Register the producer on the localhost RMI registry at the default port.- Throws:
RemoteException
- on network errorAlreadyBoundException
- on error
-
-
Method Details
-
addListener
Add a listener to the producer.- Specified by:
addListener
in interfaceProducerInterface
- 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
-
commands
protected void commands()create a small interactive application. -
main
System.exit(...) calls help to shut down RMI / socket thread that might wait for a timeout.- Parameters:
args
- nothing needed
-