Class ChannelManagerConstructor


  • public class ChannelManagerConstructor
    extends Object
    A simple utility class which assists in constructing a fresh or deserializing from disk a ChannelManager and one or more ChannelMonitors. Also constructs a PeerManager and spawns a background thread to monitor for and notify you of relevant Events.
    • Field Detail

      • channel_manager

        public final ChannelManager channel_manager
        The ChannelManager either deserialized or newly-constructed.
      • channel_manager_latest_block_hash

        public final byte[] channel_manager_latest_block_hash
        The latest block has the channel manager saw. If this is non-null it is a 32-byte block hash. You should sync the blockchain starting with the block that builds on this block.
      • channel_monitors

        public final TwoTuple_BlockHashChannelMonitorZ[] channel_monitors
        A list of ChannelMonitors and the last block they each saw. You should sync the blockchain on each individually starting with the block that builds on the hash given. After doing so (and syncing the blockchain on the channel manager as well), you should call chain_sync_completed() and then continue to normal application operation.
      • peer_manager

        public final PeerManager peer_manager
        A PeerManager which is constructed to pass messages and handle connections to peers.
      • nio_peer_handler

        public final NioPeerHandler nio_peer_handler
        A NioPeerHandler which manages a background thread to handle socket events and pass them to the peer_manager.
    • Method Detail

      • chain_sync_completed

        public void chain_sync_completed​(ChannelManagerConstructor.EventHandler event_handler)
        Utility which adds all of the deserialized ChannelMonitors to the chain watch so that further updates from the ChannelManager are processed as normal. This also spawns a background thread which will call the appropriate methods on the provided EventHandler as required.
      • interrupt

        public void interrupt()
        Interrupt the background thread, stopping the background handling of events.