Java Code Examples for org.apache.ratis.util.CollectionUtils#as()

The following examples show how to use org.apache.ratis.util.CollectionUtils#as() . 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: RaftTestUtil.java    From incubator-ratis with Apache License 2.0 5 votes vote down vote up
static Iterable<LogEntryProto> getLogEntryProtos(RaftLog log) {
  return CollectionUtils.as(log.getEntries(0, Long.MAX_VALUE), ti -> {
    try {
      return log.get(ti.getIndex());
    } catch (IOException exception) {
      throw new AssertionError("Failed to get log at " + ti, exception);
    }
  });
}
 
Example 2
Source File: RaftTestUtil.java    From ratis with Apache License 2.0 5 votes vote down vote up
static Iterable<LogEntryProto> getLogEntryProtos(RaftLog log) {
  return CollectionUtils.as(log.getEntries(0, Long.MAX_VALUE), ti -> {
    try {
      return log.get(ti.getIndex());
    } catch (IOException exception) {
      throw new AssertionError("Failed to get log at " + ti, exception);
    }
  });
}
 
Example 3
Source File: MiniRaftCluster.java    From incubator-ratis with Apache License 2.0 4 votes vote down vote up
public Iterable<RaftServerImpl> iterateServerImpls() {
  return CollectionUtils.as(getServers(), this::getRaftServerImpl);
}
 
Example 4
Source File: MiniRaftCluster.java    From ratis with Apache License 2.0 4 votes vote down vote up
public Iterable<RaftServerImpl> iterateServerImpls() {
  return CollectionUtils.as(getServers(), this::getRaftServerImpl);
}