Codota Logo
RaftClient.builder
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using io.atomix.protocols.raft.RaftClient.builder (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

/**
 * Returns a new Raft client builder.
 * <p>
 * The provided set of members will be used to connect to the Raft cluster. The members list does not have to represent
 * the complete list of servers in the cluster, but it must have at least one reachable member that can communicate with
 * the cluster's leader.
 *
 * @return The client builder.
 */
@SuppressWarnings("unchecked")
static Builder builder() {
 return builder(Collections.EMPTY_LIST);
}
origin: atomix/atomix

/**
 * Returns a new Raft client builder.
 * <p>
 * The provided set of members will be used to connect to the Raft cluster. The members list does not have to represent
 * the complete list of servers in the cluster, but it must have at least one reachable member that can communicate with
 * the cluster's leader.
 *
 * @param cluster The cluster to which to connect.
 * @return The client builder.
 */
static Builder builder(MemberId... cluster) {
 return builder(Arrays.asList(cluster));
}
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;
}
origin: atomix/atomix

 private RaftClient newRaftClient(RaftClientProtocol protocol) {
  return RaftClient.builder()
    .withClientId(partition.name())
    .withPartitionId(partition.id())
    .withMemberId(localMemberId)
    .withProtocol(protocol)
    .withThreadContextFactory(threadContextFactory)
    .build();
 }
}
io.atomix.protocols.raftRaftClientbuilder

Javadoc

Returns a new Raft client builder.

The provided set of members will be used to connect to the Raft cluster. The members list does not have to represent the complete list of servers in the cluster, but it must have at least one reachable member that can communicate with the cluster's leader.

Popular methods of RaftClient

  • close
    Closes the client.
  • connect
    Connects the client to Raft cluster via the provided server addresses. The client will connect to se
  • sessionBuilder
    Builds a Raft proxy session.
  • leader
    Returns the current leader.
  • term
    Returns the current term.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • onRequestPermissionsResult (Fragment)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JButton (javax.swing)
  • JFrame (javax.swing)
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