{
static Logger log = Logger.getLogger(DefaultClient.class.getName());
- private long id = -1;
+ private int id = -1;
private boolean isRunning = false;
private Connector reliable;
private Connector fast;
// Send our connection message with a generated ID until
// we get one back from the server. We'll hash time in
// millis and time in nanos.
- long tempId = System.currentTimeMillis() ^ System.nanoTime();
+ long tempId = System.currentTimeMillis() + System.nanoTime();
// Set it true here so we can send some messages.
isRunning = true;
return id != -1; // for now
}
- public long getId()
+ public int getId()
{
return id;
}
// interested in and then pass on the rest.
if( m instanceof ClientRegistrationMessage ) {
// Then we've gotten our real id
- this.id = ((ClientRegistrationMessage)m).getId();
+ this.id = (int)((ClientRegistrationMessage)m).getId();
log.log( Level.INFO, "Connection established, id:{0}.", this.id );
fireConnected();
return;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
static Logger log = Logger.getLogger(DefaultServer.class.getName());
private boolean isRunning = false;
- private AtomicLong nextId = new AtomicLong(0);
+ private AtomicInteger nextId = new AtomicInteger(0);
private Kernel reliable;
private KernelAdapter reliableAdapter;
private Kernel fast;
protected class Connection implements HostedConnection
{
- private long id;
+ private int id;
private Endpoint reliable;
private Endpoint fast;