added a unit test
This commit is contained in:
@ -74,4 +74,14 @@ public class GossipService {
|
||||
out.println("[" + addressString + "][" + new Date().toString() + "] " + message);*/
|
||||
out.println("[" + new Date().toString() + "] " + message);
|
||||
}
|
||||
|
||||
public GossipManager get_gossipManager() {
|
||||
return _gossipManager;
|
||||
}
|
||||
|
||||
public void set_gossipManager(GossipManager _gossipManager) {
|
||||
this._gossipManager = _gossipManager;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -36,27 +36,16 @@ abstract public class PassiveGossipThread implements Runnable {
|
||||
|
||||
public PassiveGossipThread(GossipManager gossipManager) {
|
||||
_gossipManager = gossipManager;
|
||||
|
||||
// Start the service on the given port number.
|
||||
try {
|
||||
//_server = new DatagramSocket( _gossipManager.getMyself().getPort());
|
||||
|
||||
SocketAddress socketAddress = new InetSocketAddress(_gossipManager.getMyself().getHost(), _gossipManager.getMyself().getPort());
|
||||
_server = new DatagramSocket(socketAddress);
|
||||
|
||||
// The server successfully started on the current port.
|
||||
GossipService.info("Gossip service successfully initialized on port " + _gossipManager.getMyself().getPort());
|
||||
GossipService.debug("I am " + _gossipManager.getMyself());
|
||||
} catch (SocketException ex) {
|
||||
System.err.println(ex);
|
||||
_server = null;
|
||||
// Let's communicate this to the user.
|
||||
/*
|
||||
GossipService.error("Error while starting the gossip service on port " + _gossipManager.getMyself().getPort() + ": " + ex.getMessage());
|
||||
System.exit(-1);*/
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
_keepRunning = new AtomicBoolean(true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user