Search in sources :

Example 1 with SlobrokList

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();
}
Also used : Register(com.yahoo.jrt.slobrok.api.Register) SlobrokList(com.yahoo.jrt.slobrok.api.SlobrokList)

Example 2 with SlobrokList

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();
}
Also used : Register(com.yahoo.jrt.slobrok.api.Register) Slobrok(com.yahoo.jrt.slobrok.server.Slobrok) SlobrokList(com.yahoo.jrt.slobrok.api.SlobrokList) Mirror(com.yahoo.jrt.slobrok.api.Mirror)

Example 3 with SlobrokList

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);
    }
}
Also used : SlobrokList(com.yahoo.jrt.slobrok.api.SlobrokList) IMirror(com.yahoo.jrt.slobrok.api.IMirror) Mirror(com.yahoo.jrt.slobrok.api.Mirror)

Example 4 with SlobrokList

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);
}
Also used : Register(com.yahoo.jrt.slobrok.api.Register) SlobrokList(com.yahoo.jrt.slobrok.api.SlobrokList) Spec(com.yahoo.jrt.Spec)

Example 5 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());
}
Also used : Supervisor(com.yahoo.jrt.Supervisor) Register(com.yahoo.jrt.slobrok.api.Register) SlobrokList(com.yahoo.jrt.slobrok.api.SlobrokList) Transport(com.yahoo.jrt.Transport) Spec(com.yahoo.jrt.Spec)

Aggregations

SlobrokList (com.yahoo.jrt.slobrok.api.SlobrokList)6 Register (com.yahoo.jrt.slobrok.api.Register)4 Mirror (com.yahoo.jrt.slobrok.api.Mirror)3 Spec (com.yahoo.jrt.Spec)2 Supervisor (com.yahoo.jrt.Supervisor)2 Transport (com.yahoo.jrt.Transport)2 IMirror (com.yahoo.jrt.slobrok.api.IMirror)1 Slobrok (com.yahoo.jrt.slobrok.server.Slobrok)1