Tabnine Logo
CommitLog.getMaxOffset
Code IndexAdd Tabnine to your IDE (free)

How to use
getMaxOffset
method
in
org.apache.rocketmq.store.CommitLog

Best Java code snippets using org.apache.rocketmq.store.CommitLog.getMaxOffset (Showing top 20 results out of 315)

origin: apache/rocketmq

@Override
public long getMaxPhyOffset() {
  return this.commitLog.getMaxOffset();
}
origin: apache/rocketmq

public long behind() {
  return DefaultMessageStore.this.commitLog.getMaxOffset() - this.reputFromOffset;
}
origin: apache/rocketmq

private boolean isCommitLogAvailable() {
  return this.reputFromOffset < DefaultMessageStore.this.commitLog.getMaxOffset();
}
origin: apache/rocketmq

@Override
public long slaveFallBehindMuch() {
  return this.commitLog.getMaxOffset() - this.haService.getPush2SlaveMaxOffset().get();
}
origin: apache/rocketmq

@Override
public void shutdown() {
  for (int i = 0; i < 50 && this.isCommitLogAvailable(); i++) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException ignored) {
    }
  }
  if (this.isCommitLogAvailable()) {
    log.warn("shutdown ReputMessageService, but commitlog have not finish to be dispatched, CL: {} reputFromOffset: {}",
      DefaultMessageStore.this.commitLog.getMaxOffset(), this.reputFromOffset);
  }
  super.shutdown();
}
origin: apache/rocketmq

/**
 * @throws Exception
 */
public void start() throws Exception {
  lock = lockFile.getChannel().tryLock(0, 1, false);
  if (lock == null || lock.isShared() || !lock.isValid()) {
    throw new RuntimeException("Lock failed,MQ already started");
  }
  lockFile.getChannel().write(ByteBuffer.wrap("lock".getBytes()));
  lockFile.getChannel().force(true);
  this.flushConsumeQueueService.start();
  this.commitLog.start();
  this.storeStatsService.start();
  if (this.scheduleMessageService != null && SLAVE != messageStoreConfig.getBrokerRole()) {
    this.scheduleMessageService.start();
  }
  if (this.getMessageStoreConfig().isDuplicationEnable()) {
    this.reputMessageService.setReputFromOffset(this.commitLog.getConfirmOffset());
  } else {
    this.reputMessageService.setReputFromOffset(this.commitLog.getMaxOffset());
  }
  this.reputMessageService.start();
  this.haService.start();
  this.createTempFile();
  this.addScheduleTask();
  this.shutdown = false;
}
origin: apache/rocketmq

@Override
public boolean checkInDiskByConsumeOffset(final String topic, final int queueId, long consumeOffset) {
  final long maxOffsetPy = this.commitLog.getMaxOffset();
  ConsumeQueue consumeQueue = findConsumeQueue(topic, queueId);
  if (consumeQueue != null) {
    SelectMappedBufferResult bufferConsumeQueue = consumeQueue.getIndexBuffer(consumeOffset);
    if (bufferConsumeQueue != null) {
      try {
        for (int i = 0; i < bufferConsumeQueue.getSize(); ) {
          i += ConsumeQueue.CQ_STORE_UNIT_SIZE;
          long offsetPy = bufferConsumeQueue.getByteBuffer().getLong();
          return checkInDiskByCommitOffset(offsetPy, maxOffsetPy);
        }
      } finally {
        bufferConsumeQueue.release();
      }
    } else {
      return false;
    }
  }
  return false;
}
origin: apache/rocketmq

long masterOffset = HAConnection.this.haService.getDefaultMessageStore().getCommitLog().getMaxOffset();
masterOffset =
  masterOffset
origin: didi/DDMQ

@Override
public long getMaxPhyOffset() {
  return this.commitLog.getMaxOffset();
}
origin: didi/DDMQ

private boolean isCommitLogAvailable() {
  return this.reputFromOffset < DefaultMessageStore.this.commitLog.getMaxOffset();
}
origin: didi/DDMQ

public long behind() {
  return DefaultMessageStore.this.commitLog.getMaxOffset() - this.reputFromOffset;
}
origin: didi/DDMQ

@Override
public long slaveFallBehindMuch() {
  return this.commitLog.getMaxOffset() - this.haService.getPush2SlaveMaxOffset().get();
}
origin: apache/rocketmq

final long maxOffsetPy = this.commitLog.getMaxOffset();
origin: didi/DDMQ

@Override
public void shutdown() {
  for (int i = 0; i < 50 && this.isCommitLogAvailable(); i++) {
    try {
      Thread.sleep(100);
    } catch (InterruptedException ignored) {
    }
  }
  if (this.isCommitLogAvailable()) {
    log.warn("shutdown ReputMessageService, but commitlog have not finish to be dispatched, CL: {} reputFromOffset: {}",
      DefaultMessageStore.this.commitLog.getMaxOffset(), this.reputFromOffset);
  }
  super.shutdown();
}
origin: didi/DDMQ

@Override
public boolean checkInDiskByConsumeOffset(final String topic, final int queueId, long consumeOffset) {
  final long maxOffsetPy = this.commitLog.getMaxOffset();
  ConsumeQueue consumeQueue = findConsumeQueue(topic, queueId);
  if (consumeQueue != null) {
    SelectMappedBufferResult bufferConsumeQueue = consumeQueue.getIndexBuffer(consumeOffset);
    if (bufferConsumeQueue != null) {
      try {
        for (int i = 0; i < bufferConsumeQueue.getSize(); ) {
          i += ConsumeQueue.CQ_STORE_UNIT_SIZE;
          long offsetPy = bufferConsumeQueue.getByteBuffer().getLong();
          return checkInDiskByCommitOffset(offsetPy, maxOffsetPy);
        }
      } finally {
        bufferConsumeQueue.release();
      }
    } else {
      return false;
    }
  }
  return false;
}
origin: didi/DDMQ

/**
 * @throws Exception
 */
public void start() throws Exception {
  lock = lockFile.getChannel().tryLock(0, 1, false);
  if (lock == null || lock.isShared() || !lock.isValid()) {
    throw new RuntimeException("Lock failed,MQ already started");
  }
  lockFile.getChannel().write(ByteBuffer.wrap("lock".getBytes()));
  lockFile.getChannel().force(true);
  this.flushConsumeQueueService.start();
  this.commitLog.start();
  this.storeStatsService.start();
  if (this.scheduleMessageService != null && BrokerRole.SLAVE != messageStoreConfig.getBrokerRole()) {
    this.scheduleMessageService.start();
  }
  if (this.getMessageStoreConfig().isDuplicationEnable()) {
    this.reputMessageService.setReputFromOffset(this.commitLog.getConfirmOffset());
  } else {
    this.reputMessageService.setReputFromOffset(this.commitLog.getMaxOffset());
  }
  this.reputMessageService.start();
  this.haService.start();
  this.createTempFile();
  this.addScheduleTask();
  if (BrokerRole.SLAVE != messageStoreConfig.getBrokerRole()) {
    this.haService.initInSyncOffset(getMaxPhyOffset());
  }
  this.shutdown = false;
}
origin: didi/DDMQ

long masterOffset = HAConnection.this.haService.getDefaultMessageStore().getCommitLog().getMaxOffset();
masterOffset =
  masterOffset
origin: didi/DDMQ

public boolean onRoleChange() {
  if (this.scheduleMessageService == null) {
    log.warn("scheduleMessageService is null");
    return false;
  }
  scheduleMessageService.load();
  if (BrokerRole.SLAVE != messageStoreConfig.getBrokerRole()) {
    this.scheduleMessageService.start();
    this.recoverTopicQueueTable();
    this.haService.initInSyncOffset(getMaxPhyOffset());
  } else {
    this.scheduleMessageService.shutdown();
    truncateNotSync();
    if (this.getMessageStoreConfig().isDuplicationEnable()) {
      this.reputMessageService.setReputFromOffset(this.commitLog.getConfirmOffset());
    } else {
      this.reputMessageService.setReputFromOffset(this.commitLog.getMaxOffset());
    }
  }
  log.info("role change, current role:{}", messageStoreConfig.getBrokerRole());
  return true;
}
origin: didi/DDMQ

final long maxOffsetPy = this.commitLog.getMaxOffset();
origin: org.apache.rocketmq/rocketmq-store

@Override
public long slaveFallBehindMuch() {
  return this.commitLog.getMaxOffset() - this.haService.getPush2SlaveMaxOffset().get();
}
org.apache.rocketmq.storeCommitLoggetMaxOffset

Popular methods of CommitLog

  • <init>
  • appendData
  • calMsgLength
  • checkMessageAndReturnSize
    check the message and returns the message size
  • checkSelf
  • deleteExpiredFile
  • destroy
  • doNothingForDeadCode
  • flush
  • getBeginTimeInLock
  • getConfirmOffset
  • getData
  • getConfirmOffset,
  • getData,
  • getMessage,
  • getMinOffset,
  • handleDiskFlush,
  • handleHA,
  • isMappedFileMatchedRecover,
  • load,
  • lockTimeMills

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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