public RaftServerRpc getServerRpc() { return proxy.getServerRpc(); }
public RaftServerRpc getServerRpc() { return proxy.getServerRpc(); }
@Override public void start() throws IOException { getImpls().parallelStream().forEach(RaftServerImpl::start); lifeCycle.startAndTransition(() -> { LOG.info("{}: start RPC server", getId()); getServerRpc().start(); }, IOException.class); }
@Override public void start() { LOG.info("{}: start", getId()); JavaUtils.getAndConsume(impl, RaftServerImpl::start); getServerRpc().start(); }
@Override public void close() { LOG.info("{}: close", getId()); JavaUtils.getAndConsume(impl, RaftServerImpl::shutdown); try { getServerRpc().close(); } catch (IOException ignored) { LOG.warn("Failed to close RPC server for " + getId(), ignored); } }
@Override public void close() { lifeCycle.checkStateAndClose(() -> { LOG.info("{}: close", getId()); impls.close(); try { getServerRpc().close(); } catch(IOException ignored) { LOG.warn(getId() + ": Failed to close " + getRpcType() + " server", ignored); } }); }
public static RaftServerProxy newRaftServer( RaftPeerId id, RaftGroup group, StateMachine.Registry stateMachineRegistry, RaftProperties properties, Parameters parameters) throws IOException { final RaftServerProxy proxy; try { // attempt multiple times to avoid temporary bind exception proxy = JavaUtils.attempt( () -> new RaftServerProxy(id, stateMachineRegistry, group, properties, parameters), 5, 500L, "new RaftServerProxy", RaftServerProxy.LOG); } catch (InterruptedException e) { throw IOUtils.toInterruptedIOException( "Interrupted when creating RaftServer " + id + ", " + group, e); } catch (IOException e) { throw new IOException("Failed to create RaftServer " + id + ", " + group, e); } // add peers into rpc service if (!group.getPeers().isEmpty()) { proxy.getServerRpc().addPeers(group.getPeers()); } return proxy; }
getServerRpc().addPeers(request.getGroup().getPeers()); newImpl.start(); impl.complete(newImpl);
public static RaftPeer toRaftPeer(RaftServerProxy s) { return new RaftPeer(s.getId(), s.getServerRpc().getInetSocketAddress()); }
public static RaftPeer toRaftPeer(RaftServerProxy s) { return new RaftPeer(s.getId(), s.getServerRpc().getInetSocketAddress()); }