/** * <p>Closes the given channel using {@link ServerConnectionEventHandler#closeChannel()} and * {@link PaymentChannelV1ServerState#close()} to notify any connected client of channel closure and to complete and * broadcast the latest payment transaction.</p> * * <p>Removes the given channel from this set of {@link StoredServerChannel}s and notifies the wallet of a change to * this wallet extension.</p> */ public void closeChannel(StoredServerChannel channel) { lock.lock(); try { if (mapChannels.remove(channel.contract.getHash()) == null) return; } finally { lock.unlock(); } synchronized (channel) { channel.closeConnectedHandler(); try { TransactionBroadcaster broadcaster = getBroadcaster(); channel.getOrCreateState(wallet, broadcaster).close(); } catch (InsufficientMoneyException e) { log.error("Exception when closing channel", e); } catch (VerificationException e) { log.error("Exception when closing channel", e); } channel.state = null; } updatedChannel(channel); }
/** * <p>Closes the given channel using {@link ServerConnectionEventHandler#closeChannel()} and * {@link PaymentChannelV1ServerState#close()} to notify any connected client of channel closure and to complete and * broadcast the latest payment transaction.</p> * * <p>Removes the given channel from this set of {@link StoredServerChannel}s and notifies the wallet of a change to * this wallet extension.</p> */ public void closeChannel(StoredServerChannel channel) { lock.lock(); try { if (mapChannels.remove(channel.contract.getHash()) == null) return; } finally { lock.unlock(); } synchronized (channel) { channel.closeConnectedHandler(); try { TransactionBroadcaster broadcaster = getBroadcaster(); channel.getOrCreateState(wallet, broadcaster).close(); } catch (InsufficientMoneyException e) { log.error("Exception when closing channel", e); } catch (VerificationException e) { log.error("Exception when closing channel", e); } channel.state = null; } updatedChannel(channel); }
/** * <p>Closes the given channel using {@link ServerConnectionEventHandler#closeChannel()} and * {@link PaymentChannelV1ServerState#close()} to notify any connected client of channel closure and to complete and * broadcast the latest payment transaction.</p> * * <p>Removes the given channel from this set of {@link StoredServerChannel}s and notifies the wallet of a change to * this wallet extension.</p> */ public void closeChannel(StoredServerChannel channel) { lock.lock(); try { if (mapChannels.remove(channel.contract.getHash()) == null) return; } finally { lock.unlock(); } synchronized (channel) { channel.closeConnectedHandler(); try { TransactionBroadcaster broadcaster = getBroadcaster(); channel.getOrCreateState(wallet, broadcaster).close(); } catch (InsufficientMoneyException e) { log.error("Exception when closing channel", e); } catch (VerificationException e) { log.error("Exception when closing channel", e); } channel.state = null; } updatedChannel(channel); }
/** * <p>Closes the given channel using {@link ServerConnectionEventHandler#closeChannel()} and * {@link PaymentChannelV1ServerState#close()} to notify any connected client of channel closure and to complete and * broadcast the latest payment transaction.</p> * * <p>Removes the given channel from this set of {@link StoredServerChannel}s and notifies the wallet of a change to * this wallet extension.</p> */ public void closeChannel(StoredServerChannel channel) { lock.lock(); try { if (mapChannels.remove(channel.contract.getHash()) == null) return; } finally { lock.unlock(); } synchronized (channel) { channel.closeConnectedHandler(); try { TransactionBroadcaster broadcaster = getBroadcaster(); channel.getOrCreateState(wallet, broadcaster).close(); } catch (InsufficientMoneyException e) { log.error("Exception when closing channel", e); } catch (VerificationException e) { log.error("Exception when closing channel", e); } channel.state = null; } updatedChannel(channel); }