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 RMIObject implements ProducerInterface
Producer.java.Copyright (c) 2019-2021 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.- Author:
- Alexander Verbraeck
- 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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 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
-
-
Method Detail
-
addListener
public void addListener(ListenerInterface listener) throws RemoteException
Add a listener to the producer.- Specified by:
addListener
in interfaceProducerInterface
- 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
-
commands
protected void commands()
create a small interactive application.
-
main
public static void main(String[] args)
System.exit(...) calls help to shut down RMI / socket thread that might wait for a timeout.- Parameters:
args
- nothing needed
-
-