removed Collection<> references

This commit is contained in:
Gianluigi 2014-08-26 18:40:41 +02:00
parent 6ebd687d39
commit 2b03a1a38e
5 changed files with 9 additions and 15 deletions

View File

@ -100,16 +100,6 @@ public class EthereumImpl implements Ethereum {
WorldManager.getInstance().addListener(listener); WorldManager.getInstance().addListener(listener);
} }
private void sleep10Milli(){
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override @Override
public void loadBlockChain() { public void loadBlockChain() {
WorldManager.getInstance().loadBlockchain(); WorldManager.getInstance().loadBlockchain();

View File

@ -111,7 +111,7 @@ public class PeersTableModel extends AbstractTableModel {
synchronized (peerInfoList) { synchronized (peerInfoList) {
peerInfoList.clear(); peerInfoList.clear();
final Collection<PeerData> peers = WorldManager.getInstance().getPeers(); final Queue<PeerData> peers = WorldManager.getInstance().getPeers();
for (PeerData peer : peers) { for (PeerData peer : peers) {
InetAddress addr = peer.getInetAddress(); InetAddress addr = peer.getInetAddress();
Location cr = IpGeoDB.getLocationForIp(addr); Location cr = IpGeoDB.getLocationForIp(addr);

View File

@ -16,9 +16,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex; import org.spongycastle.util.encoders.Hex;
import java.util.AbstractQueue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Queue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.ethereum.config.SystemProperties.CONFIG; import static org.ethereum.config.SystemProperties.CONFIG;
@ -87,7 +89,7 @@ public class ClientPeer {
handler.killTimers(); handler.killTimers();
final Collection<PeerData> peers = WorldManager.getInstance().getPeers(); final Queue<PeerData> peers = WorldManager.getInstance().getPeers();
for (PeerData peer : peers){ for (PeerData peer : peers){
if (host.equals(peer.getInetAddress().getHostAddress()) && if (host.equals(peer.getInetAddress().getHostAddress()) &&

View File

@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Queue;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -25,11 +26,11 @@ public class PeerDiscovery {
private ThreadPoolExecutor executorPool; private ThreadPoolExecutor executorPool;
private PeerDiscoveryMonitorThread monitor; private PeerDiscoveryMonitorThread monitor;
private final Collection<PeerData> peers; private final Queue<PeerData> peers;
private final AtomicBoolean started = new AtomicBoolean(false); private final AtomicBoolean started = new AtomicBoolean(false);
public PeerDiscovery(Collection<PeerData> peers) { public PeerDiscovery(Queue<PeerData> peers) {
this.peers = peers; this.peers = peers;
} }

View File

@ -122,7 +122,8 @@ public class MessagesTest {
assertEquals(2, peersMessage.getPeers().size()); assertEquals(2, peersMessage.getPeers().size());
PeerData peerData = peersMessage.getPeers().iterator().next(); Iterator<PeerData> it = peersMessage.getPeers().iterator(); it.next();
PeerData peerData = it.next();
assertEquals("/81.99.225.18", peerData.getInetAddress().toString()); assertEquals("/81.99.225.18", peerData.getInetAddress().toString());
assertEquals(30303, peerData.getPort()); assertEquals(30303, peerData.getPort());