Codota Logo
LogRecord
Code IndexAdd Codota to your IDE (free)

How to use
LogRecord
in
io.atomix.primitive.log

Best Java code snippets using io.atomix.primitive.log.LogRecord (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: atomix/atomix

 @Override
 public String toString() {
  return toStringHelper(this)
    .add("index", index())
    .add("timestamp", timestamp())
    .add("value", ArraySizeHashPrinter.of(value()))
    .toString();
 }
}
origin: atomix/atomix

/**
 * Handles a records request.
 *
 * @param request the request to handle
 */
private void handleRecords(RecordsRequest request) {
 if (request.reset()) {
  index = request.record().index() - 1;
 }
 if (request.record().index() == index + 1) {
  Consumer<LogRecord> consumer = this.consumer;
  if (consumer != null) {
   consumer.accept(request.record());
   index = request.record().index();
  }
 } else {
  protocol.reset(leader, ResetRequest.request(memberId, subject, index + 1));
 }
}
origin: atomix/atomix

/**
 * Sends the next batch to the consumer.
 */
void next() {
 if (!open) {
  return;
 }
 context.threadContext().execute(() -> {
  if (reader.hasNext()) {
   Indexed<LogEntry> entry = reader.next();
   LogRecord record = new LogRecord(entry.index(), entry.entry().timestamp(), entry.entry().value());
   boolean reset = reader.getFirstIndex() == entry.index();
   RecordsRequest request = RecordsRequest.request(record, reset);
   log.trace("Sending {} to {} at {}", request, memberId, subject);
   context.protocol().produce(memberId, subject, request);
   next();
  }
 });
}
origin: io.atomix/atomix-log

/**
 * Handles a records request.
 *
 * @param request the request to handle
 */
private void handleRecords(RecordsRequest request) {
 if (request.reset()) {
  index = request.record().index() - 1;
 }
 if (request.record().index() == index + 1) {
  Consumer<LogRecord> consumer = this.consumer;
  if (consumer != null) {
   consumer.accept(request.record());
   index = request.record().index();
  }
 } else {
  protocol.reset(leader, ResetRequest.request(memberId, subject, index + 1));
 }
}
origin: io.atomix/atomix-log

/**
 * Sends the next batch to the consumer.
 */
void next() {
 if (!open) {
  return;
 }
 context.threadContext().execute(() -> {
  if (reader.hasNext()) {
   Indexed<LogEntry> entry = reader.next();
   LogRecord record = new LogRecord(entry.index(), entry.entry().timestamp(), entry.entry().value());
   boolean reset = reader.getFirstIndex() == entry.index();
   RecordsRequest request = RecordsRequest.request(record, reset);
   log.trace("Sending {} to {} at {}", request, memberId, subject);
   context.protocol().produce(memberId, subject, request);
   next();
  }
 });
}
origin: atomix/atomix

@Override
public CompletableFuture<Void> consume(long offset, Consumer<Record<E>> consumer) {
 return session.consumer().consume(offset, record ->
   consumer.accept(new Record<E>(record.index(), record.timestamp(), decode(record.value()))));
}
origin: atomix/atomix

private void consume(LogRecord record) {
 LogOperation operation = decodeInternal(record.value());
 currentIndex = record.index();
 currentSession = session;
 currentOperation = operation.operationId().type();
 currentTimestamp = record.timestamp();
 while (pendingRead != null && pendingRead.index <= record.index()) {
  session = getOrCreateSession(this.session.sessionId());
  currentSession = session;
origin: io.atomix/atomix

@Override
public CompletableFuture<Void> consume(long offset, Consumer<Record<E>> consumer) {
 return session.consumer().consume(offset, record ->
   consumer.accept(new Record<E>(record.index(), record.timestamp(), decode(record.value()))));
}
io.atomix.primitive.logLogRecord

Javadoc

Distributed log protocol record.

A log record represents an entry in a distributed log. The record includes an #index() and a #timestamp() at which the entry was committed to the log in addition to the #value()of the entry.

Most used methods

  • index
  • timestamp
  • value
  • <init>

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now