From 9f2e9de94f7c2a55f3c82c4d1ea359bdc5882ee1 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 10 Nov 2014 07:49:08 +0100 Subject: [PATCH] Extract MessageModule.BOOTSTRAP_NODE_KEY constant --- src/main/java/io/bitsquare/msg/MessageModule.java | 4 +++- .../java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/bitsquare/msg/MessageModule.java b/src/main/java/io/bitsquare/msg/MessageModule.java index d2f7976d11..bcd89ee2e6 100644 --- a/src/main/java/io/bitsquare/msg/MessageModule.java +++ b/src/main/java/io/bitsquare/msg/MessageModule.java @@ -34,6 +34,8 @@ public abstract class MessageModule extends BitsquareModule { public static final String BOOTSTRAP_NODE_PORT_KEY = "port"; public static final String NETWORK_INTERFACE_KEY = "networkInterface"; + public static final String BOOTSTRAP_NODE_KEY = "bootstrapNode"; + protected MessageModule(Properties properties) { super(properties); } @@ -52,7 +54,7 @@ public abstract class MessageModule extends BitsquareModule { ); bind(Node.class) - .annotatedWith(Names.named("bootstrapNode")) + .annotatedWith(Names.named(BOOTSTRAP_NODE_KEY)) .toInstance(bootstrapNode); bind(String.class) diff --git a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java index a13a12856e..6870021bb5 100644 --- a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java +++ b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java @@ -68,6 +68,8 @@ import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static io.bitsquare.msg.MessageModule.BOOTSTRAP_NODE_KEY; + /** * Creates a DHT peer and bootstrap to the network via a seed node */ @@ -91,7 +93,7 @@ class BootstrappedPeerFactory { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public BootstrappedPeerFactory(Persistence persistence, @Named("bootstrapNode") Node bootstrapNode, + public BootstrappedPeerFactory(Persistence persistence, @Named(BOOTSTRAP_NODE_KEY) Node bootstrapNode, @Named("networkInterface") String networkInterface) { this.persistence = persistence; this.bootstrapNode = bootstrapNode;