Search in sources :

Example 1 with Register

use of com.yahoo.jrt.slobrok.api.Register 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 Register

use of com.yahoo.jrt.slobrok.api.Register 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 Register

use of com.yahoo.jrt.slobrok.api.Register 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 4 with Register

use of com.yahoo.jrt.slobrok.api.Register 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

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