mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-20 10:12:19 +01:00
ForwardingService: make Closable
not AutoCloseable
`Closeable` implements `AutoCloseable` but narrows the exception thrown from `Exception` to `IOException`. ForwardingService.close() currently doesn't throw any exceptions.
This commit is contained in:
parent
c10cf7ccbe
commit
84c8a2887a
@ -38,6 +38,7 @@ import org.bitcoinj.wallet.SendRequest;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -48,7 +49,7 @@ import static java.util.stream.Collectors.toList;
|
||||
* ForwardingService demonstrates basic usage of the library. It sits on the network and when it receives coins, simply
|
||||
* sends them onwards to an address given on the command line.
|
||||
*/
|
||||
public class ForwardingService implements AutoCloseable {
|
||||
public class ForwardingService implements Closeable {
|
||||
static final String USAGE = "Usage: address-to-send-back-to [mainnet|testnet|signet|regtest]";
|
||||
static final int REQUIRED_CONFIRMATIONS = 1;
|
||||
static final int MAX_CONNECTIONS = 4;
|
||||
@ -144,8 +145,7 @@ public class ForwardingService implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the service. {@link AutoCloseable} will be triggered if an unhandled exception occurs within
|
||||
* a <i>try-with-resources</i> block.
|
||||
* Close the service.
|
||||
* <p>
|
||||
* Note that {@link WalletAppKit#setAutoStop(boolean)} is set by default and installs a shutdown handler
|
||||
* via {@link Runtime#addShutdownHook(Thread)} so we do not need to worry about explicitly shutting down
|
||||
|
Loading…
Reference in New Issue
Block a user