Extract MessageModule.BOOTSTRAP_NODE_KEY constant

This commit is contained in:
Chris Beams 2014-11-10 07:49:08 +01:00
parent 05a86f251f
commit 9f2e9de94f
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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;