Upgrade to Guava 16.0.1.

Resolves issue 375.
This commit is contained in:
Andreas Schildbach
2014-04-06 15:54:17 +02:00
committed by Mike Hearn
parent 9a54a7753d
commit 6087e43377
24 changed files with 210 additions and 82 deletions

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2013 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +74,8 @@ public class ExamplePaymentChannelClient {
wallet().addExtension(new StoredPaymentChannelClientStates(wallet(), peerGroup()));
}
};
appKit.startAndWait();
appKit.startAsync();
appKit.awaitRunning();
// We now have active network connections and a fully synced wallet.
// Add a new key which will be used for the multisig contract.
appKit.wallet().addKey(myKey);
@@ -103,7 +105,8 @@ public class ExamplePaymentChannelClient {
log.info("Waiting ...");
Thread.sleep(60 * 60 * 1000); // 1 hour.
log.info("Stopping ...");
appKit.stopAndWait();
appKit.stopAsync();
appKit.awaitTerminated();
}
private void openAndSend(int timeoutSecs, InetSocketAddress server, String channelID) throws IOException, ValueOutOfRangeException, InterruptedException {

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2013 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +58,8 @@ public class ExamplePaymentChannelServer implements PaymentChannelServerListener
wallet().addExtension(storedStates);
}
};
appKit.startAndWait();
appKit.startAsync();
appKit.awaitRunning();
System.out.println(appKit.wallet());

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2011 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +38,8 @@ public class FetchBlock {
BlockStore blockStore = new MemoryBlockStore(params);
BlockChain chain = new BlockChain(params, blockStore);
PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.startAndWait();
peerGroup.startAsync();
peerGroup.awaitRunning();
PeerAddress addr = new PeerAddress(InetAddress.getLocalHost(), params.getPort());
peerGroup.addAddress(addr);
peerGroup.waitForPeers(1).get();
@@ -48,6 +50,6 @@ public class FetchBlock {
System.out.println("Waiting for node to send us the requested block: " + blockHash);
Block block = future.get();
System.out.println(block);
peerGroup.stop();
peerGroup.stopAsync();
}
}

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2012 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +39,8 @@ public class FetchTransactions {
BlockStore blockStore = new MemoryBlockStore(params);
BlockChain chain = new BlockChain(params, blockStore);
PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.startAndWait();
peerGroup.startAsync();
peerGroup.awaitRunning();
peerGroup.addAddress(new PeerAddress(InetAddress.getLocalHost(), params.getPort()));
peerGroup.waitForPeers(1).get();
Peer peer = peerGroup.getConnectedPeers().get(0);
@@ -56,6 +58,7 @@ public class FetchTransactions {
}
System.out.println("Done.");
peerGroup.stopAndWait();
peerGroup.stopAsync();
peerGroup.awaitTerminated();
}
}

View File

@@ -1,5 +1,6 @@
/**
* Copyright 2013 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +75,8 @@ public class ForwardingService {
}
// Download the block chain and wait until it's done.
kit.startAndWait();
kit.startAsync();
kit.awaitRunning();
// We want to know when we receive money.
kit.wallet().addEventListener(new AbstractWalletEventListener() {

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2012 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +58,7 @@ public class PeerMonitor {
public PeerMonitor() {
setupNetwork();
setupGUI();
peerGroup.start();
peerGroup.startAsync();
}
private void setupNetwork() {
@@ -113,7 +114,8 @@ public class PeerMonitor {
@Override
public void windowClosing(WindowEvent windowEvent) {
System.out.println("Shutting down ...");
peerGroup.stopAndWait();
peerGroup.stopAsync();
peerGroup.awaitTerminated();
System.out.println("Shutdown complete.");
System.exit(0);
}

View File

@@ -1,5 +1,6 @@
/**
* Copyright 2011 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,9 +62,9 @@ public class PrivateKeys {
final PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.addAddress(new PeerAddress(InetAddress.getLocalHost()));
peerGroup.start();
peerGroup.startAsync();
peerGroup.downloadBlockChain();
peerGroup.stop();
peerGroup.stopAsync();
// And take them!
System.out.println("Claiming " + Utils.bitcoinValueToFriendlyString(wallet.getBalance()) + " coins");

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2011 Google Inc.
* Copyright 2014 Andreas Schildbach
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +42,7 @@ public class RefreshWallet {
final PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.addAddress(new PeerAddress(InetAddress.getLocalHost()));
peerGroup.start();
peerGroup.startAsync();
wallet.addEventListener(new AbstractWalletEventListener() {
@Override
@@ -53,7 +54,7 @@ public class RefreshWallet {
// Now download and process the block chain.
peerGroup.downloadBlockChain();
peerGroup.stop();
peerGroup.stopAsync();
wallet.saveToFile(file);
System.out.println("\nDone!\n");
System.out.println(wallet.toString());