Package org.djutils.demo.rmi
Class Listener
- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteServer
-
- java.rmi.server.UnicastRemoteObject
-
- org.djutils.rmi.RMIObject
-
- org.djutils.demo.rmi.Listener
-
- All Implemented Interfaces:
Serializable
,Remote
,ListenerInterface
public class Listener extends RMIObject implements ListenerInterface
Listener.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getListenerName()
String
getName()
Return the name under which the listenerInterface is registered.static void
main(String[] args)
void
notify(String payload)
Notify the listener of 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
-
Listener
public Listener(String listenerName) throws RemoteException, AlreadyBoundException, NotBoundException
Explicit definition of constructor has to be included to be able to throws RemoteException.- Parameters:
listenerName
- the name of the listener in the registry- Throws:
RemoteException
- on network errorAlreadyBoundException
- on errorNotBoundException
- when producer cannot be found
-
-
Method Detail
-
getName
public String getName() throws RemoteException
Return the name under which the listenerInterface is registered.- Specified by:
getName
in interfaceListenerInterface
- Returns:
- the name
- Throws:
RemoteException
- on network error
-
notify
public void notify(String payload) throws RemoteException
Notify the listener of a message.- Specified by:
notify
in interfaceListenerInterface
- Parameters:
payload
- the message- Throws:
RemoteException
- on network error
-
getListenerName
public String getListenerName()
- Returns:
- listenerName
-
main
public static void main(String[] args)
- Parameters:
args
- args name of the listener
-
-