/** * <p>Called when the connection terminates. Notifies the {@link StoredClientChannel} object that we can attempt to * resume this channel in the future and stops generating messages for the server.</p> * * <p>For stateless protocols, this translates to a client not using the channel for the immediate future, but * intending to reopen the channel later. There is likely little reason to use this in a stateless protocol.</p> * * <p>Note that this <b>MUST</b> still be called even after either * {@link org.bitcoinj.protocols.channels.IPaymentChannelClient.ClientConnection#destroyConnection(org.bitcoinj.protocols.channels.PaymentChannelCloseException.CloseReason)} or * {@link PaymentChannelClient#settle()} is called, to actually handle the connection close logic.</p> */ @Override public void connectionClosed() { lock.lock(); try { connectionOpen = false; if (state != null) state.disconnectFromChannel(); } finally { lock.unlock(); } }
/** * <p>Called when the connection terminates. Notifies the {@link StoredClientChannel} object that we can attempt to * resume this channel in the future and stops generating messages for the server.</p> * * <p>For stateless protocols, this translates to a client not using the channel for the immediate future, but * intending to reopen the channel later. There is likely little reason to use this in a stateless protocol.</p> * * <p>Note that this <b>MUST</b> still be called even after either * {@link ClientConnection#destroyConnection(org.bitcoinj.protocols.channels.PaymentChannelCloseException.CloseReason)} or * {@link PaymentChannelClient#settle()} is called, to actually handle the connection close logic.</p> */ @Override public void connectionClosed() { lock.lock(); try { connectionOpen = false; if (state != null) state.disconnectFromChannel(); } finally { lock.unlock(); } }
/** * <p>Called when the connection terminates. Notifies the {@link StoredClientChannel} object that we can attempt to * resume this channel in the future and stops generating messages for the server.</p> * * <p>For stateless protocols, this translates to a client not using the channel for the immediate future, but * intending to reopen the channel later. There is likely little reason to use this in a stateless protocol.</p> * * <p>Note that this <b>MUST</b> still be called even after either * {@link ClientConnection#destroyConnection(org.bitcoinj.protocols.channels.PaymentChannelCloseException.CloseReason)} or * {@link PaymentChannelClient#settle()} is called, to actually handle the connection close logic.</p> */ @Override public void connectionClosed() { lock.lock(); try { connectionOpen = false; if (state != null) state.disconnectFromChannel(); } finally { lock.unlock(); } }
/** * <p>Called when the connection terminates. Notifies the {@link StoredClientChannel} object that we can attempt to * resume this channel in the future and stops generating messages for the server.</p> * * <p>For stateless protocols, this translates to a client not using the channel for the immediate future, but * intending to reopen the channel later. There is likely little reason to use this in a stateless protocol.</p> * * <p>Note that this <b>MUST</b> still be called even after either * {@link ClientConnection#destroyConnection(org.bitcoinj.protocols.channels.PaymentChannelCloseException.CloseReason)} or * {@link PaymentChannelClient#settle()} is called, to actually handle the connection close logic.</p> */ @Override public void connectionClosed() { lock.lock(); try { connectionOpen = false; if (state != null) state.disconnectFromChannel(); } finally { lock.unlock(); } }
/** * Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet * storage and throwing an {@link IllegalStateException} if it is. */ public synchronized void checkNotExpired() { if (Utils.currentTimeSeconds() > getExpiryTime()) { stateMachine.transition(State.EXPIRED); disconnectFromChannel(); throw new IllegalStateException("Channel expired"); } }
/** * Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet * storage and throwing an {@link IllegalStateException} if it is. */ public synchronized void checkNotExpired() { if (Utils.currentTimeSeconds() > getExpiryTime()) { stateMachine.transition(State.EXPIRED); disconnectFromChannel(); throw new IllegalStateException("Channel expired"); } }
/** * Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet * storage and throwing an {@link IllegalStateException} if it is. */ public synchronized void checkNotExpired() { if (Utils.currentTimeSeconds() > getExpiryTime()) { stateMachine.transition(State.EXPIRED); disconnectFromChannel(); throw new IllegalStateException("Channel expired"); } }
/** * Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet * storage and throwing an {@link IllegalStateException} if it is. */ public synchronized void checkNotExpired() { if (Utils.currentTimeSeconds() > getExpiryTime()) { stateMachine.transition(State.EXPIRED); disconnectFromChannel(); throw new IllegalStateException("Channel expired"); } }