New static ID for first node, logger level
This commit is contained in:
parent
e977c20024
commit
6a23d56e2d
@ -1,8 +1,7 @@
|
||||
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
|
||||
handlers=java.util.logging.ConsoleHandler
|
||||
|
||||
tutego.level = ALL
|
||||
.level=ALL
|
||||
|
||||
java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n
|
||||
|
||||
java.util.logging.ConsoleHandler.level=ALL
|
||||
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
||||
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
||||
java.util.logging.ConsoleHandler.level = ALL
|
||||
|
||||
@ -13,14 +13,14 @@ public class Identifier {
|
||||
this.bits = BitSet.valueOf(bytes);
|
||||
}
|
||||
|
||||
public Identifier(BitSet bits) {
|
||||
private Identifier(BitSet bits) {
|
||||
this.bits = bits;
|
||||
}
|
||||
|
||||
public Identifier() {
|
||||
public static Identifier getStaticIdentifier() {
|
||||
BitSet middle = new BitSet(Node.ID_BITS);
|
||||
middle.set(0);
|
||||
this.bits = middle;
|
||||
middle.set(Node.ID_BITS - 1);
|
||||
return new Identifier(middle);
|
||||
}
|
||||
|
||||
public static Identifier getRandomIdentifier() {
|
||||
|
||||
@ -32,7 +32,8 @@ public class Node {
|
||||
* The first node is always spawned on port 50000
|
||||
*/
|
||||
private static final int INITIAL_PORT = 50000;
|
||||
private static final Identifier INITIAL_ID = new Identifier();
|
||||
private static final Identifier INITIAL_ID = Identifier
|
||||
.getStaticIdentifier();
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(Node.class.getName());
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ public class Bucket {
|
||||
if (entries.contains(newEntry)) {
|
||||
// Move to beginning
|
||||
LOGGER.log(
|
||||
Level.INFO,
|
||||
Level.FINE,
|
||||
"Node {0} ({1}) already in routing table. Move to end of bucket.",
|
||||
new Object[] { newEntry.id, newEntry.address });
|
||||
if (entries.size() > 1) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user