3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 23:03:04 +00:00

Clear a few more misc IntelliJ inspection alerts.

This commit is contained in:
Mike Hearn 2013-03-11 15:04:17 +01:00
parent fb9bfb960e
commit a6d0c9169b
2 changed files with 82 additions and 91 deletions

View File

@ -127,7 +127,7 @@ public class Peer {
private volatile Channel vChannel; private volatile Channel vChannel;
private volatile VersionMessage vPeerVersionMessage; private volatile VersionMessage vPeerVersionMessage;
private boolean isAcked; private boolean isAcked;
private PeerHandler handler; private final PeerHandler handler;
/** /**
* Construct a peer that reads/writes from the given block chain. * Construct a peer that reads/writes from the given block chain.
@ -983,7 +983,7 @@ public class Peer {
/** /**
* Sends the given message on the peers Channel. * Sends the given message on the peers Channel.
*/ */
public ChannelFuture sendMessage(Message m) throws IOException { public ChannelFuture sendMessage(Message m) {
// This does not need to be locked. // This does not need to be locked.
return Channels.write(vChannel, m); return Channels.write(vChannel, m);
} }
@ -1103,9 +1103,9 @@ public class Peer {
// The future that will be invoked when the pong is heard back. // The future that will be invoked when the pong is heard back.
public SettableFuture<Long> future; public SettableFuture<Long> future;
// The random nonce that lets us tell apart overlapping pings/pongs. // The random nonce that lets us tell apart overlapping pings/pongs.
public long nonce; public final long nonce;
// Measurement of the time elapsed. // Measurement of the time elapsed.
public long startTimeMsec; public final long startTimeMsec;
public PendingPing(long nonce) { public PendingPing(long nonce) {
future = SettableFuture.create(); future = SettableFuture.create();

View File

@ -889,13 +889,9 @@ public class PeerGroup extends AbstractIdleService {
} }
boolean success = false; boolean success = false;
for (Peer p : announceToPeers) { for (Peer p : announceToPeers) {
try {
log.info("{}: Announcing {} pending wallet transactions", p.getAddress(), inv.getItems().size()); log.info("{}: Announcing {} pending wallet transactions", p.getAddress(), inv.getItems().size());
p.sendMessage(inv); p.sendMessage(inv);
success = true; success = true;
} catch (IOException e) {
log.warn("Failed to announce 'inv' to peer: {}", p);
}
} }
return success; return success;
} }
@ -1138,7 +1134,6 @@ public class PeerGroup extends AbstractIdleService {
log.info("broadcastTransaction: Enough peers, adding {} to the memory pool and sending to {}", log.info("broadcastTransaction: Enough peers, adding {} to the memory pool and sending to {}",
tx.getHashAsString(), somePeer); tx.getHashAsString(), somePeer);
final Transaction pinnedTx = memoryPool.seen(tx, somePeer.getAddress()); final Transaction pinnedTx = memoryPool.seen(tx, somePeer.getAddress());
try {
// Prepare to send the transaction by adding a listener that'll be called when confidence changes. // Prepare to send the transaction by adding a listener that'll be called when confidence changes.
// Only bother with this if we might actually hear back: // Only bother with this if we might actually hear back:
if (minConnections > 1) tx.getConfidence().addEventListener(new TransactionConfidence.Listener() { if (minConnections > 1) tx.getConfidence().addEventListener(new TransactionConfidence.Listener() {
@ -1225,10 +1220,6 @@ public class PeerGroup extends AbstractIdleService {
} }
}); });
} }
} catch (IOException e) {
future.setException(e);
return;
}
} }
}, MoreExecutors.sameThreadExecutor()); }, MoreExecutors.sameThreadExecutor());
return future; return future;