public interface EObject
The solution is to have an eBus dispatcher thread trigger the object start up and shutdown methods. While the object is opening feeds, any and all callbacks triggered by the feed opening will not be posted until after the start up method returns.
A similar issue exists with shutting down application objects from a non-eBus thread: after a feed is closed, the feed may still deliver messages to the application object. Shutting down feeds from an eBus thread removes this issue since all the object's pending message queue will be cleared.
An application can either override these methods or
provide a Runnable
lambda expression as the start up
and/or shutdown methods to
EFeed.register(EObject, String)
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME_NOT_SET
Default eBus object name is "(not set)".
|
Modifier and Type | Method and Description |
---|---|
default java.lang.String |
name()
Returns eBus object name.
|
default void |
shutdown()
EFeed.shutdown(EObject) calls this method to
asynchronously shutdown an eBus client from an eBus
thread. |
default void |
startup()
EFeed.startup(EObject) calls this method to
asynchronously start up an eBus client from an eBus
thread. |
static final java.lang.String NAME_NOT_SET
default java.lang.String name()
NAME_NOT_SET
.default void startup()
EFeed.startup(EObject)
calls this method to
asynchronously start up an eBus client from an eBus
thread. This means that object start up processing will
not be interrupted by an eBus callback.
The default implementation does nothing. This method can
be "overridden" using a Runnable
interface
implementation.
shutdown()
default void shutdown()
EFeed.shutdown(EObject)
calls this method to
asynchronously shutdown an eBus client from an eBus
thread. This means that object shutdown processing will
not be interrupted by an eBus callback.
Note: having eBus shutdown an application object results in all open eBus feeds associated with that application object being closed. It is not possible to partially shutdown the object's feeds. The eBus shutdown functionality should be used only when the object is no longer needed.
The default implementation does nothing. This method can
be "overridden" using a Runnable
interface
implementation.
startup()
Copyright © 2001 - 2024. Charles W. Rapp. All rights reserved.