Tabnine Logo
RaftClient.connect
Code IndexAdd Tabnine to your IDE (free)

How to use
connect
method
in
io.atomix.protocols.raft.RaftClient

Best Java code snippets using io.atomix.protocols.raft.RaftClient.connect (Showing top 6 results out of 315)

origin: atomix/atomix

/**
 * Connects the client to Raft cluster via the default server address.
 * <p>
 * If the client was built with a default cluster list, the default server addresses will be used. Otherwise, the client
 * will attempt to connect to localhost:8700.
 * <p>
 * The client will connect to servers in the cluster according to the pattern specified by the configured
 * {@link CommunicationStrategy}.
 *
 * @return A completable future to be completed once the client is registered.
 */
default CompletableFuture<RaftClient> connect() {
 return connect((Collection<MemberId>) null);
}
origin: atomix/atomix

/**
 * Connects the client to Raft cluster via the provided server addresses.
 * <p>
 * The client will connect to servers in the cluster according to the pattern specified by the configured
 * {@link CommunicationStrategy}.
 *
 * @param members A set of server addresses to which to connect.
 * @return A completable future to be completed once the client is registered.
 */
default CompletableFuture<RaftClient> connect(MemberId... members) {
 if (members == null || members.length == 0) {
  return connect();
 } else {
  return connect(Arrays.asList(members));
 }
}
origin: atomix/atomix

@Override
public CompletableFuture<RaftPartitionClient> start() {
 synchronized (RaftPartitionClient.this) {
  client = newRaftClient(protocol);
 }
 return client.connect(partition.members()).whenComplete((r, e) -> {
  if (e == null) {
   log.debug("Successfully started client for partition {}", partition.id());
  } else {
   log.warn("Failed to start client for partition {}", partition.id(), e);
  }
 }).thenApply(v -> null);
}
origin: atomix/atomix

/**
 * Creates a Raft client.
 */
private RaftClient createClient() throws Exception {
 MemberId memberId = nextNodeId();
 RaftClientProtocol protocol;
 if (USE_NETTY) {
  Address address = Address.from(++port);
  MessagingService messagingManager = new NettyMessagingService("test", address, new MessagingConfig()).start().join();
  addressMap.put(memberId, address);
  protocol = new RaftClientMessagingProtocol(messagingManager, PROTOCOL_SERIALIZER, addressMap::get);
 } else {
  protocol = protocolFactory.newClientProtocol(memberId);
 }
 RaftClient client = RaftClient.builder()
   .withMemberId(memberId)
   .withProtocol(protocol)
   .build();
 client.connect(members.stream().map(RaftMember::memberId).collect(Collectors.toList())).join();
 clients.add(client);
 return client;
}
origin: apache/zeppelin

 @Override
 public void run() {
  LOGGER.info("RaftClientThread run() >>>");
  int raftClientPort = 0;
  try {
   raftClientPort = RemoteInterpreterUtils.findRandomAvailablePortOnAllLocalInterfaces();
  } catch (IOException e) {
   LOGGER.error(e.getMessage());
  }
  MemberId memberId = MemberId.from(ZEPL_CLIENT_ID + zeplServerHost + ":" + raftClientPort);
  Address address = Address.from(zeplServerHost, raftClientPort);
  raftAddressMap.put(memberId, address);
  MessagingService messagingManager
    = NettyMessagingService.builder().withAddress(address).build().start().join();
  RaftClientProtocol protocol = new RaftClientMessagingProtocol(
    messagingManager, protocolSerializer, raftAddressMap::get);
  raftClient = RaftClient.builder()
    .withMemberId(memberId)
    .withPartitionId(PartitionId.from("partition", 1))
    .withProtocol(protocol)
    .build();
  raftClient.connect(clusterMemberIds).join();
  raftSessionClient = createProxy(raftClient);
  LOGGER.info("RaftClientThread run() <<<");
 }
}).start();
origin: atomix/atomix

/**
 * Creates a Raft client.
 */
private RaftClient createClient() throws Exception {
 Member member = nextNode();
 RaftClientProtocol protocol;
 if (USE_NETTY) {
  MessagingService messagingService = new NettyMessagingService("test", member.address(), new MessagingConfig()).start().join();
  protocol = new RaftClientMessagingProtocol(messagingService, PROTOCOL_SERIALIZER, addressMap::get);
 } else {
  protocol = protocolFactory.newClientProtocol(member.id());
 }
 RaftClient client = RaftClient.builder()
   .withMemberId(member.id())
   .withPartitionId(PartitionId.from("test", 1))
   .withProtocol(protocol)
   .withThreadModel(ThreadModel.SHARED_THREAD_POOL)
   .build();
 client.connect(members.stream().map(Member::id).collect(Collectors.toList())).join();
 clients.add(client);
 return client;
}
io.atomix.protocols.raftRaftClientconnect

Javadoc

Connects the client to Raft cluster via the default server address.

If the client was built with a default cluster list, the default server addresses will be used. Otherwise, the client will attempt to connect to localhost:8700.

The client will connect to servers in the cluster according to the pattern specified by the configured CommunicationStrategy.

Popular methods of RaftClient

  • builder
    Returns a new Raft client builder. The provided set of members will be used to connect to the Raft c
  • close
    Closes the client.
  • sessionBuilder
    Builds a Raft proxy session.
  • leader
    Returns the current leader.
  • term
    Returns the current term.

Popular in Java

  • Updating database using SQL prepared statement
  • setScale (BigDecimal)
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now