io.atomix.catalyst.transport.Address.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中io.atomix.catalyst.transport.Address.hashCode()方法的一些代码示例,展示了Address.hashCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.hashCode()方法的具体详情如下:
包路径:io.atomix.catalyst.transport.Address
类名称:Address
方法名:hashCode

Address.hashCode介绍

暂无

代码示例

代码示例来源:origin: atomix/copycat

@Override
public int id() {
 return serverAddress.hashCode();
}

代码示例来源:origin: atomix/copycat

@Override
public int hashCode() {
 return serverAddress.hashCode();
}

代码示例来源:origin: atomix/copycat

@Override
public int id() {
 return serverAddress.hashCode();
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

@Override
public int hashCode() {
 return serverAddress.hashCode();
}

代码示例来源:origin: io.atomix.copycat/copycat-server

@Override
public int hashCode() {
 return serverAddress.hashCode();
}

代码示例来源:origin: atomix/copycat

@Override
public int id() {
 return serverAddress.hashCode();
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Creates a connection for the given member.
 *
 * @param address The member for which to create the connection.
 * @return A completable future to be called once the connection has been created.
 */
private CompletableFuture<Connection> createConnection(Address address) {
 return client.connect(address).thenApply(connection -> {
  connections.put(address.hashCode(), connection);
  connection.closeListener(c -> connections.remove(address.hashCode()));
  return connection;
 });
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

/**
 * Returns the connection for the given member.
 *
 * @param address The member for which to get the connection.
 * @return A completable future to be called once the connection is received.
 */
private CompletableFuture<Connection> getConnection(Address address) {
 Connection connection = connections.get(address.hashCode());
 return connection == null ? createConnection(address) : CompletableFuture.completedFuture(connection);
}

代码示例来源:origin: atomix/copycat

@Override
public int id() {
 return serverAddress.hashCode();
}

代码示例来源:origin: io.atomix/atomix-group

/**
 * Creates a connection for the given member.
 *
 * @param address The member for which to create the connection.
 * @return A completable future to be called once the connection has been created.
 */
CompletableFuture<Connection> createConnection(Address address) {
 return client.connect(address).thenApply(connection -> {
  connections.put(address.hashCode(), connection);
  connection.closeListener(c -> connections.remove(address.hashCode()));
  return connection;
 });
}

代码示例来源:origin: io.atomix/atomix-group

/**
 * Returns the connection for the given member.
 *
 * @param address The member for which to get the connection.
 * @return A completable future to be called once the connection is received.
 */
CompletableFuture<Connection> getConnection(Address address) {
 ComposableFuture<Connection> future = new ComposableFuture<>();
 context.executor().execute(() -> {
  Connection connection = connections.get(address.hashCode());
  if (connection != null) {
   future.complete(connection);
  } else {
   createConnection(address).whenComplete(future);
  }
 });
 return future;
}

代码示例来源:origin: atomix/copycat

/**
 * Creates a Copycat server.
 */
private CopycatServer createServer(Member member) {
 CopycatServer.Builder builder = CopycatServer.builder(member.clientAddress(), member.serverAddress())
  .withType(member.type())
  .withTransport(new NettyTransport())
  .withStorage(Storage.builder()
   .withStorageLevel(StorageLevel.DISK)
   .withDirectory(new File(String.format("target/performance-logs/%d", member.address().hashCode())))
   .withCompactionThreads(1)
   .build())
  .withStateMachine(PerformanceStateMachine::new);
 CopycatServer server = builder.build();
 server.serializer().disableWhitelist();
 servers.add(server);
 return server;
}

代码示例来源:origin: atomix/copycat

/**
 * Creates a Copycat server.
 */
private CopycatServer createServer(Member member) {
 CopycatServer.Builder builder = CopycatServer.builder(member.clientAddress(), member.serverAddress())
  .withType(member.type())
  .withTransport(new NettyTransport())
  .withStorage(Storage.builder()
   .withStorageLevel(StorageLevel.DISK)
   .withDirectory(new File(String.format("target/fuzz-logs/%d", member.address().hashCode())))
   .withMaxSegmentSize(randomNumber(1024 * 1024 * 7) + (1024 * 1024))
   .withMaxEntriesPerSegment(randomNumber(10000) + 1000)
   .withCompactionThreads(randomNumber(4) + 1)
   .withCompactionThreshold(Math.random() / (double) 2)
   .withEntryBufferSize(randomNumber(10000) + 1)
   .withFlushOnCommit(randomBoolean())
   .withMinorCompactionInterval(Duration.ofSeconds(randomNumber(30) + 15))
   .withMajorCompactionInterval(Duration.ofSeconds(randomNumber(60) + 60))
   .build())
  .withStateMachine(FuzzStateMachine::new);
 CopycatServer server = builder.build();
 server.serializer().disableWhitelist();
 servers.add(server);
 return server;
}

代码示例来源:origin: org.onosproject/onlab-thirdparty

PollRequest request = PollRequest.builder()
 .withTerm(context.getTerm())
 .withCandidate(context.getCluster().member().address().hashCode())
 .withLogIndex(lastIndex)
 .withLogTerm(lastTerm)

代码示例来源:origin: org.onosproject/onlab-thirdparty

@Override
public CompletableFuture<VoteResponse> vote(VoteRequest request) {
 context.checkThread();
 logRequest(request);
 // If the request indicates a term that is greater than the current term then
 // assign that term and leader to the current context and step down as a candidate.
 if (updateTermAndLeader(request.term(), 0)) {
  CompletableFuture<VoteResponse> future = super.vote(request);
  context.transition(CopycatServer.State.FOLLOWER);
  return future;
 }
 // If the vote request is not for this candidate then reject the vote.
 if (request.candidate() == context.getCluster().member().address().hashCode()) {
  return CompletableFuture.completedFuture(logResponse(VoteResponse.builder()
   .withStatus(Response.Status.OK)
   .withTerm(context.getTerm())
   .withVoted(true)
   .build()));
 } else {
  return CompletableFuture.completedFuture(logResponse(VoteResponse.builder()
   .withStatus(Response.Status.OK)
   .withTerm(context.getTerm())
   .withVoted(false)
   .build()));
 }
}

相关文章