use of com.yahoo.jrt.slobrok.api.SlobrokList in project vespa by vespa-engine.
the class DummyVdsNode method connect.
public int connect() throws ListenFailedException, UnknownHostException {
if (resetTimestampOnReconnect) {
startTimestamp = timer.getCurrentTimeInMillis() / 1000;
nodeState.setStartTimestamp(startTimestamp);
resetTimestampOnReconnect = false;
}
supervisor = new Supervisor(new Transport());
addMethods();
acceptor = supervisor.listen(new Spec(0));
SlobrokList slist = new SlobrokList();
slist.setup(slobrokConnectionSpecs);
register = new Register(supervisor, slist, new Spec("localhost", acceptor.port()), new BackOff());
registerSlobrok();
negotiatedHandle = false;
return acceptor.port();
}
use of com.yahoo.jrt.slobrok.api.SlobrokList in project vespa by vespa-engine.
the class SlobrokTest method setUp.
public void setUp() throws ListenFailedException {
slobrok = new Slobrok();
slobroks = new String[1];
slobroks[0] = new Spec("localhost", slobrok.port()).toString();
SlobrokList slobroklist = new SlobrokList();
slobroklist.setup(slobroks);
acceptor = server.listen(new Spec(0));
mirror = new Mirror(client, slobroklist);
register = new Register(server, slobroklist, "localhost", acceptor.port());
mySpec = new Spec("localhost", acceptor.port()).toString();
}
use of com.yahoo.jrt.slobrok.api.SlobrokList in project vespa by vespa-engine.
the class ExternalSlobrokPolicy method configure.
@Override
public synchronized void configure(SlobroksConfig config) {
String[] slist = new String[config.slobrok().size()];
for (int i = 0; i < config.slobrok().size(); i++) {
slist[i] = config.slobrok(i).connectionspec();
}
if (slobroks == null) {
slobroks = new SlobrokList();
}
slobroks.setup(slist);
if (mirror == null) {
mirror = new Mirror(orb, slobroks);
}
}
use of com.yahoo.jrt.slobrok.api.SlobrokList in project vespa by vespa-engine.
the class ContainerRpcAdaptor method registerInSlobrok.
public synchronized void registerInSlobrok(List<String> slobrokConnectionSpecs) {
shutdownSlobrokRegistrator();
if (slobrokConnectionSpecs.isEmpty()) {
return;
}
if (!slobrokId.isPresent()) {
throw new AssertionError("Slobrok id must be set first");
}
SlobrokList slobrokList = new SlobrokList();
slobrokList.setup(slobrokConnectionSpecs.stream().toArray(String[]::new));
Spec mySpec = new Spec(hostname, acceptor.port());
Register register = new Register(supervisor, slobrokList, mySpec);
register.registerName(slobrokId.get());
slobrokRegistrator = Optional.of(register);
log.log(LogLevel.INFO, "Registered name '" + slobrokId.get() + "' at " + mySpec + " with: " + slobrokList);
}
use of com.yahoo.jrt.slobrok.api.SlobrokList in project vespa by vespa-engine.
the class RpcServer method connect.
public void connect() throws ListenFailedException, UnknownHostException {
disconnect();
log.log(LogLevel.DEBUG, "Fleetcontroller " + fleetControllerIndex + ": Connecting RPC server.");
if (supervisor != null)
disconnect();
supervisor = new Supervisor(new Transport());
addMethods();
log.log(LogLevel.DEBUG, "Fleetcontroller " + fleetControllerIndex + ": Attempting to bind to port " + port);
acceptor = supervisor.listen(new Spec(port));
log.log(LogLevel.DEBUG, "Fleetcontroller " + fleetControllerIndex + ": RPC server listening to port " + acceptor.port());
StringBuffer slobroks = new StringBuffer("(");
for (String s : slobrokConnectionSpecs) {
slobroks.append(" ").append(s);
}
slobroks.append(" )");
SlobrokList slist = new SlobrokList();
slist.setup(slobrokConnectionSpecs);
Spec spec = new Spec(HostName.getLocalhost(), acceptor.port());
log.log(LogLevel.INFO, "Registering " + spec + " with slobrok at " + slobroks);
if (slobrokBackOffPolicy != null) {
register = new Register(supervisor, slist, spec, slobrokBackOffPolicy);
} else {
register = new Register(supervisor, slist, spec);
}
register.registerName(getSlobrokName());
}
Aggregations