djutils v2.1.2
Further enhanced the remote event producing and event listening capabilities of djutils to help the RmiEventProducer
and RmiEventListener
to work without issues.
djutils project, event package
- New
hashCode()
andequals()
implementation forEvent
andEventType
- The
EventListener
andEventProducer
interfaces are nowRemote
. Note that since Java 8u241, a not so well documented change has been made in Remote classes for RMI. See https://bugs.openjdk.org/browse/JDK-8237213: Only those methods specified in a "remote interface", an interface that DIRECTLY extendsjava.rmi.Remote
are available remotely. This means that when the Remote interface is added in a sub-interface, methods are NOT available remotely. Repeating the method declaration in the interface that extendsRemote
will correctly indicate the method is a remote method. The base interface does not need to extend Remote if the method is re-declared in theRemote
interface. - The
EventProducer
interface also implements allfireEvent()
methods. This is to make it easier for classes implementing theEventProducer
interface to immediately have all the publisher's behavior available. All methods throwRemoteException
; theLocalEventProducer
(which only needs to implement 1 real method now) wraps all methods with a try-catch, as noRemoteException
s are to be expected from aLocalEventProducer
. If such an Exception would happen, it wraps it in aRuntimeException
. - The
LocalEventProducer
now extends the 'rich'EventProducer
interface. All method implementations are embedded in the interface (addListener
,removeListener
,fireEvent
,fireTimedEvent
, etc.). TheLocalEventProducer
wraps these methods because it is not expected to throw aRemoteException
. - The
RmiEventProducer
now extends the 'rich'EventProducer
interface. All method implementations are embedded in the interface (addListener
,removeListener
,fireEvent
,fireTimedEvent
, etc.). Since all methods throwRemoteException
, and theEventProducer
interface extendsRemote
, theRmiEventProducer
only has to implement a single method for the Event producing behavior.