Java Code Examples for io.atomix.utils.concurrent.Futures#completedFuture()

The following examples show how to use io.atomix.utils.concurrent.Futures#completedFuture() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<CommandResponse> onCommand(CommandRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(CommandResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 2
Source File: LocalRaftServerProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftServerProtocol> getServer(MemberId memberId) {
  LocalRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 3
Source File: TestLogClientProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestLogServerProtocol> getServer(MemberId memberId) {
  TestLogServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 4
Source File: TestRaftServerProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestRaftClientProtocol> getClient(MemberId memberId) {
  TestRaftClientProtocol client = client(memberId);
  if (client != null) {
    return Futures.completedFuture(client);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 5
Source File: TestRaftServerProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestRaftServerProtocol> getServer(MemberId memberId) {
  TestRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 6
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<ReconfigureResponse> onReconfigure(ReconfigureRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(ReconfigureResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 7
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<JoinResponse> onJoin(JoinRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(JoinResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 8
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<InstallResponse> onInstall(InstallRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(InstallResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 9
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<CloseSessionResponse> onCloseSession(CloseSessionRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(CloseSessionResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 10
Source File: TestRaftClientProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestRaftServerProtocol> getServer(MemberId memberId) {
  TestRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 11
Source File: LocalRaftClientProtocol.java    From submarine with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftServerProtocol> getServer(MemberId memberId) {
  LocalRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 12
Source File: InactiveRole.java    From atomix with Apache License 2.0 5 votes vote down vote up
@Override
public CompletableFuture<VoteResponse> onVote(VoteRequest request) {
  logRequest(request);
  return Futures.completedFuture(logResponse(VoteResponse.builder()
      .withStatus(Status.ERROR)
      .withError(RaftError.Type.UNAVAILABLE)
      .build()));
}
 
Example 13
Source File: TestPrimaryBackupServerProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestPrimaryBackupServerProtocol> getServer(MemberId memberId) {
  TestPrimaryBackupServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 14
Source File: TestPrimaryBackupClientProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestPrimaryBackupServerProtocol> getServer(MemberId memberId) {
  TestPrimaryBackupServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 15
Source File: LocalRaftServerProtocol.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftClientProtocol> getClient(MemberId memberId) {
  LocalRaftClientProtocol client = client(memberId);
  if (client != null) {
    return Futures.completedFuture(client);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 16
Source File: LocalRaftServerProtocol.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftServerProtocol> getServer(MemberId memberId) {
  LocalRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 17
Source File: TestLogServerProtocol.java    From atomix with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<TestLogClientProtocol> getClient(MemberId memberId) {
  TestLogClientProtocol client = client(memberId);
  if (client != null) {
    return Futures.completedFuture(client);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 18
Source File: LocalRaftServerProtocol.java    From submarine with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftClientProtocol> getClient(MemberId memberId) {
  LocalRaftClientProtocol client = client(memberId);
  if (client != null) {
    return Futures.completedFuture(client);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 19
Source File: LocalRaftServerProtocol.java    From submarine with Apache License 2.0 5 votes vote down vote up
private CompletableFuture<LocalRaftServerProtocol> getServer(MemberId memberId) {
  LocalRaftServerProtocol server = server(memberId);
  if (server != null) {
    return Futures.completedFuture(server);
  } else {
    return Futures.exceptionalFuture(new ConnectException());
  }
}
 
Example 20
Source File: DistributedNavigableSetProxy.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<Boolean> remove(E element) {
  return isInBounds(element) ? DistributedNavigableSetProxy.this.remove(element) : Futures.completedFuture(false);
}