Package org.ldk.structs
Class EventsProvider
- java.lang.Object
-
- org.ldk.structs.EventsProvider
-
public class EventsProvider extends Object
A trait indicating an object may generate events. Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. # Requirements See [`process_pending_events`] for requirements around event processing. When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending event since the last invocation. The handler must either act upon the event immediately or preserve it for later handling. Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to consult the provider's documentation on the implication of processing events and how a handler may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and [`ChainMonitor::process_pending_events`]). (C-not implementable) As there is likely no reason for a user to implement this trait on their own type(s). [`process_pending_events`]: Self::process_pending_events [`handle_event`]: EventHandler::handle_event [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EventsProvider.EventsProviderInterface
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
static EventsProvider
new_impl(EventsProvider.EventsProviderInterface arg)
void
process_pending_events(EventHandler handler)
Processes any events generated since the last call using the given event handler.
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
new_impl
public static EventsProvider new_impl(EventsProvider.EventsProviderInterface arg)
-
process_pending_events
public void process_pending_events(EventHandler handler)
Processes any events generated since the last call using the given event handler. Subsequent calls must only process new events. However, handlers must be capable of handling duplicate events across process restarts. This may occur if the provider was recovered from an old state (i.e., it hadn't been successfully persisted after processing pending events).
-
-