Codota Logo
RaftClient.connect
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
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

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • findViewById (Activity)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JTable (javax.swing)
  • Runner (org.openjdk.jmh.runner)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now