mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-13 11:36:15 +01:00
WalletAppKit: make Closeable
This commit is contained in:
parent
84c8a2887a
commit
884072c9e3
2 changed files with 8 additions and 2 deletions
|
@ -46,6 +46,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -84,7 +85,7 @@ import static org.bitcoinj.base.internal.Preconditions.checkState;
|
|||
* if anything goes wrong during startup - you should probably handle it and use {@link Exception#getCause()} to figure
|
||||
* out what went wrong more precisely. Same thing if you just use the {@link #startAsync()} method.</p>
|
||||
*/
|
||||
public class WalletAppKit extends AbstractIdleService {
|
||||
public class WalletAppKit extends AbstractIdleService implements Closeable {
|
||||
protected static final Logger log = LoggerFactory.getLogger(WalletAppKit.class);
|
||||
|
||||
protected final BitcoinNetwork network;
|
||||
|
@ -504,6 +505,11 @@ public class WalletAppKit extends AbstractIdleService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
stopAsync();
|
||||
}
|
||||
|
||||
public BitcoinNetwork network() {
|
||||
return network;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class ForwardingService implements Closeable {
|
|||
if (kit.isRunning()) {
|
||||
kit.wallet().removeCoinsReceivedEventListener(listener);
|
||||
}
|
||||
kit.stopAsync();
|
||||
kit.close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue