congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ServiceExecutor
Code IndexAdd Tabnine to your IDE (free)

How to use
ServiceExecutor
in
io.atomix.primitive.service

Best Java code snippets using io.atomix.primitive.service.ServiceExecutor (Showing top 9 results out of 315)

origin: apache/zeppelin

@Override
protected void configure(ServiceExecutor executor) {
 executor.register(PUT, this::put);
 executor.register(GET, this::get);
 executor.register(REMOVE, this::remove);
 executor.register(INDEX, this::index);
}
origin: atomix/atomix

@Override
public final byte[] apply(Commit<byte[]> commit) {
 return executor.apply(commit);
}
origin: atomix/atomix

@Override
public final void tick(WallClockTimestamp timestamp) {
 executor.tick(timestamp);
}
origin: atomix/atomix

/**
 * Registers a operation callback.
 *
 * @param operationId the operation identifier
 * @param callback    the operation callback
 * @throws NullPointerException if the {@code operationId} or {@code callback} is null
 */
default void register(OperationId operationId, Runnable callback) {
 checkNotNull(operationId, "operationId cannot be null");
 checkNotNull(callback, "callback cannot be null");
 handle(operationId, commit -> {
  callback.run();
  return null;
 });
}
origin: atomix/atomix

@Override
protected void configure(ServiceExecutor executor) {
 executor.register(PrimaryElectorOperations.ENTER, this::enter);
 executor.register(PrimaryElectorOperations.GET_TERM, this::getTerm);
}
origin: atomix/atomix

@Override
protected void configure(ServiceExecutor executor) {
 executor.register(PUT, this::put);
 executor.register(GET, this::get);
 executor.register(REMOVE, this::remove);
 executor.register(INDEX, this::index);
}
origin: atomix/atomix

@Override
protected void configure(ServiceExecutor executor) {
 executor.register(PUT, this::put);
 executor.register(GET, this::get);
 executor.register(REMOVE, this::remove);
 executor.register(INDEX, this::index);
}
origin: atomix/atomix

@Override
protected void configure(ServiceExecutor executor) {
 executor.register(SessionIdGeneratorOperations.NEXT, this::next);
}
origin: atomix/atomix

if (method.getReturnType() == Void.TYPE) {
 if (method.getParameterTypes().length == 0) {
  executor.register(operationId, () -> {
   try {
    method.invoke(this);
  executor.register(operationId, args -> {
   try {
    method.invoke(this, (Object[]) args.value());
  executor.register(operationId, () -> {
   try {
    return method.invoke(this);
  executor.register(operationId, args -> {
   try {
    return method.invoke(this, (Object[]) args.value());
io.atomix.primitive.serviceServiceExecutor

Javadoc

Facilitates registration and execution of state machine commands and provides deterministic scheduling.

The state machine executor is responsible for managing input to and output from a PrimitiveService. As operations are committed to the Raft log, the executor is responsible for applying them to the state machine. OperationType#COMMAND are guaranteed to be applied to the state machine in the order in which they appear in the Raft log and always in the same thread, so state machines don't have to be thread safe. OperationType#QUERY are not generally written to the Raft log and will instead be applied according to their Consistency.

State machines can use the executor to provide deterministic scheduling during the execution of command callbacks.

 
private Object putWithTtl(Commit commit) ); 
} 
} 
As with all state machine callbacks, the executor will ensure scheduled callbacks are executed sequentially and deterministically. As long as state machines schedule callbacks deterministically, callbacks will be executed deterministically. Internally, the state machine executor triggers callbacks based on various timestamps in the Raft log. This means the scheduler is dependent on internal or user-defined operations being written to the log. Prior to the execution of a command, any expired scheduled callbacks will be executed based on the command's logged timestamp.

It's important to note that callbacks can only be scheduled during PrimitiveOperation operations or by recursive scheduling. If a state machine attempts to schedule a callback via the executor during the execution of a query, a IllegalStateException will be thrown. This is because queries are usually only applied on a single state machine within the cluster, and so scheduling callbacks in reaction to query execution would not be deterministic.

Most used methods

  • register
  • apply
    Applies the given commit to the executor.
  • handle
    Registers a operation callback.
  • tick
    Increments the service clock.

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now