io.atomix.catalyst.util.Assert.state()方法的使用及代码示例

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

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

Assert.state介绍

暂无

代码示例

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

/**
 * Checks that the snapshot can be written.
 */
protected void checkWriter() {
 Assert.state(writer == null, "cannot create multiple writers for the same snapshot");
}

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

/**
 * Asserts that the manager is open.
 * 
 * @throws IllegalStateException if the segment manager is not open
 */
private void assertOpen() {
 Assert.state(currentSegment != null, "segment manager not open");
}

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

/**
 * Asserts that the manager is open.
 * 
 * @throws IllegalStateException if the segment manager is not open
 */
private void assertOpen() {
 Assert.state(currentSegment != null, "segment manager not open");
}

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

/**
 * Checks whether the commit is open and throws an exception if not.
 */
private void checkOpen() {
 Assert.state(references.get() > 0, "commit not open");
}

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

/**
 * Checks whether the commit is open and throws an exception if not.
 */
private void checkOpen() {
 Assert.state(references.get() > 0, "commit not open");
}

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

/**
 * Opens the given snapshot reader.
 */
protected SnapshotReader openReader(SnapshotReader reader, SnapshotDescriptor descriptor) {
 Assert.state(descriptor.locked(), "cannot read from unlocked snapshot descriptor");
 return reader;
}

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

/**
  * @throws IllegalStateException is session is not positive
  */
 @Override
 public KeepAliveRequest build() {
  super.build();
  Assert.state(request.session > 0, "session must be positive");
  return request;
 }
}

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

/**
 * @throws IllegalStateException if member is null
 */
@Override
public U build() {
 super.build();
 Assert.state(request.member != null, "member cannot be null");
 return request;
}

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

/**
 * Asserts that the log is open.
 *
 * @throws IllegalStateException if the log is not open
 */
private void assertIsOpen() {
 Assert.state(isOpen(), "log is not open");
}

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

/**
 * @throws IllegalStateException if active members or passive members are null
 */
@Override
public U build() {
 super.build();
 if (response.status == Status.OK) {
  Assert.state(response.members != null, "activeMembers members cannot be null");
 }
 return response;
}

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

/**
 * @throws IllegalStateException if the current thread is not a catalyst thread
 */
static ThreadContext currentContextOrThrow() {
 ThreadContext context = currentContext();
 Assert.state(context != null, "not on a Catalyst thread");
 return context;
}

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

/**
 * Asserts that the log is open.
 * 
 * @throws IllegalStateException if the log is not open
 */
private void assertIsOpen() {
 Assert.state(isOpen(), "log is not open");
}

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

public SingleThreadContext(Thread thread, ScheduledExecutorService executor, Serializer serializer) {
 this.executor = executor;
 this.serializer = serializer;
 Assert.state(thread instanceof CatalystThread, "not a Catalyst thread");
 ((CatalystThread) thread).setContext(this);
}

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

@Override
public Scheduled schedule(Duration initialDelay, Duration interval, Runnable callback) {
 Assert.state(context.type() == ServerStateMachineContext.Type.COMMAND, "callbacks can only be scheduled during command execution");
 LOGGER.trace("Scheduled repeating callback {} with initial delay {} and interval {}", callback, initialDelay, interval);
 return new ServerScheduledTask(callback, initialDelay.toMillis(), interval.toMillis()).schedule();
}

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

@Override
public Scheduled schedule(Duration initialDelay, Duration interval, Runnable callback) {
 Assert.state(context.type() == ServerStateMachineContext.Type.COMMAND, "callbacks can only be scheduled during command execution");
 LOGGER.trace("Scheduled repeating callback {} with initial delay {} and interval {}", callback, initialDelay, interval);
 return new ServerScheduledTask(callback, initialDelay.toMillis(), interval.toMillis()).schedule();
}

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

@Override
public Scheduled schedule(Duration delay, Runnable callback) {
 Assert.state(context.type() == ServerStateMachineContext.Type.COMMAND, "callbacks can only be scheduled during command execution");
 LOGGER.trace("Scheduled callback {} with delay {}", callback, delay);
 return new ServerScheduledTask(callback, delay.toMillis()).schedule();
}

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

@Override
public <T> CompletableFuture<T> execute(Supplier<T> callback) {
 Assert.state(context.consistency() != null, "callbacks can only be scheduled during command execution");
 CompletableFuture<T> future = new CompletableFuture<>();
 tasks.add(new ServerTask(callback, future));
 return future;
}

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

@Override
public <T> CompletableFuture<T> execute(Supplier<T> callback) {
 Assert.state(context.type() == ServerStateMachineContext.Type.COMMAND, "callbacks can only be scheduled during command execution");
 CompletableFuture<T> future = new NonBlockingFuture<>();
 tasks.add(new ServerTask(callback, future));
 return future;
}

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

@Override
public <T> CompletableFuture<T> execute(Supplier<T> callback) {
 Assert.state(context.type() == ServerStateMachineContext.Type.COMMAND, "callbacks can only be scheduled during command execution");
 CompletableFuture<T> future = new NonBlockingFuture<>();
 tasks.add(new ServerTask(callback, future));
 return future;
}

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

@Override
public synchronized SnapshotReader reader() {
 Assert.state(file.file().exists(), "missing snapshot file: %s", file.file());
 Buffer buffer = FileBuffer.allocate(file.file(), SnapshotDescriptor.BYTES);
 SnapshotDescriptor descriptor = new SnapshotDescriptor(buffer);
 int length = buffer.position(SnapshotDescriptor.BYTES).readInt();
 return openReader(new SnapshotReader(buffer.mark().limit(SnapshotDescriptor.BYTES + Integer.BYTES + length), this, store.serializer()), descriptor);
}

相关文章