Tabnine Logo
RollCycle.format
Code IndexAdd Tabnine to your IDE (free)

How to use
format
method
in
net.openhft.chronicle.queue.RollCycle

Best Java code snippets using net.openhft.chronicle.queue.RollCycle.format (Showing top 8 results out of 315)

origin: OpenHFT/Chronicle-Queue

SCQRoll(@NotNull RollCycle rollCycle,
    long epoch,
    @Nullable LocalTime rollTime,
    @Nullable ZoneId rollTimeZone) {
  this.length = rollCycle.length();
  this.format = rollCycle.format();
  this.epoch = epoch;
  this.rollTime = rollTime;
  this.rollTimeZone = rollTimeZone;
}
origin: OpenHFT/Chronicle-Queue

public RollingResourcesCache(@NotNull final RollCycle cycle, long epoch,
               @NotNull Function<String, File> nameToFile,
               @NotNull Function<File, String> fileToName) {
  this(cycle.length(), cycle.format(), epoch, nameToFile, fileToName);
}
origin: OpenHFT/Chronicle-Queue

private void validateRollCycle(File metapath) {
  if (!metapath.exists()) {
    // no metadata, so we need to check if there're cq4 files and if so try to validate roll cycle
    // the code is slightly brutal and crude but should work for most cases. It will NOT work if files were created with
    // the following cycles: LARGE_HOURLY_SPARSE LARGE_HOURLY_XSPARSE LARGE_DAILY XLARGE_DAILY HUGE_DAILY HUGE_DAILY_XSPARSE
    // for such cases user MUST use correct roll cycle when creating the queue
    String[] list = path.list((d, name) -> name.endsWith(SingleChronicleQueue.SUFFIX));
    if (list != null && list.length > 0) {
      String filename = list[0];
      if (rollCycle().format().length() + 4 != filename.length()) {
        // probably different roll cycle used
        overrideRollCycleForFileNameLength(filename.length() - 4);
      }
    }
  }
}
origin: OpenHFT/Chronicle-Queue

protected void initializeMetadata() {
  File metapath = metapath();
  validateRollCycle(metapath);
  SCQMeta metadata = new SCQMeta(new SCQRoll(rollCycle(), epoch(), rollTime, rollTimeZone), deltaCheckpointInterval(),
      sourceId());
  try {
    boolean readOnly = readOnly();
    metaStore = SingleTableBuilder.binary(metapath, metadata).timeoutMS(timeoutMS()).readOnly(readOnly).build();
    // check if metadata was overridden
    SCQMeta newMeta = metaStore.metadata();
    if (sourceId() == 0)
      sourceId(newMeta.sourceId());
    if (!newMeta.roll().format().equals(rollCycle().format())) {
      // roll cycle changed
      overrideRollCycleForFileNameLength(newMeta.roll().format().length());
    }
    // if it was overriden - reset
    rollTime = newMeta.roll().rollTime();
    rollTimeZone = newMeta.roll().rollTimeZone();
    epoch = newMeta.roll().epoch();
  } catch (IORuntimeException ex) {
    // readonly=true and file doesn't exist
    if (OS.isWindows())
      throw ex; // we cant have a read-only table store on windows so we have no option but to throw the ex.
    Jvm.warn().on(getClass(), "Failback to readonly tablestore", ex);
    metaStore = new ReadonlyTableStore<>(metadata);
  }
}
origin: net.openhft/chronicle-queue

public RollingResourcesCache(@NotNull final RollCycle cycle, long epoch,
               @NotNull Function<String, File> nameToFile,
               @NotNull Function<File, String> fileToName) {
  this(cycle.length(), cycle.format(), epoch, nameToFile, fileToName);
}
origin: net.openhft/chronicle-queue

SCQRoll(@NotNull RollCycle rollCycle,
    long epoch,
    @Nullable LocalTime rollTime,
    @Nullable ZoneId rollTimeZone) {
  this.length = rollCycle.length();
  this.format = rollCycle.format();
  this.epoch = epoch;
  this.rollTime = rollTime;
  this.rollTimeZone = rollTimeZone;
}
origin: net.openhft/chronicle-queue

private void validateRollCycle(File metapath) {
  if (!metapath.exists()) {
    // no metadata, so we need to check if there're cq4 files and if so try to validate roll cycle
    // the code is slightly brutal and crude but should work for most cases. It will NOT work if files were created with
    // the following cycles: LARGE_HOURLY_SPARSE LARGE_HOURLY_XSPARSE LARGE_DAILY XLARGE_DAILY HUGE_DAILY HUGE_DAILY_XSPARSE
    // for such cases user MUST use correct roll cycle when creating the queue
    String[] list = path.list((d, name) -> name.endsWith(SingleChronicleQueue.SUFFIX));
    if (list != null && list.length > 0) {
      String filename = list[0];
      if (rollCycle().format().length() + 4 != filename.length()) {
        // probably different roll cycle used
        overrideRollCycleForFileNameLength(filename.length() - 4);
      }
    }
  }
}
origin: net.openhft/chronicle-queue

protected void initializeMetadata() {
  File metapath = metapath();
  validateRollCycle(metapath);
  SCQMeta metadata = new SCQMeta(new SCQRoll(rollCycle(), epoch(), rollTime, rollTimeZone), deltaCheckpointInterval(),
      sourceId());
  try {
    boolean readOnly = readOnly();
    metaStore = SingleTableBuilder.binary(metapath, metadata).timeoutMS(timeoutMS()).readOnly(readOnly).build();
    // check if metadata was overridden
    SCQMeta newMeta = metaStore.metadata();
    if (sourceId() == 0)
      sourceId(newMeta.sourceId());
    if (!newMeta.roll().format().equals(rollCycle().format())) {
      // roll cycle changed
      overrideRollCycleForFileNameLength(newMeta.roll().format().length());
    }
    // if it was overriden - reset
    rollTime = newMeta.roll().rollTime();
    rollTimeZone = newMeta.roll().rollTimeZone();
    epoch = newMeta.roll().epoch();
  } catch (IORuntimeException ex) {
    // readonly=true and file doesn't exist
    if (OS.isWindows())
      throw ex; // we cant have a read-only table store on windows so we have no option but to throw the ex.
    Jvm.warn().on(getClass(), "Failback to readonly tablestore", ex);
    metaStore = new ReadonlyTableStore<>(metadata);
  }
}
net.openhft.chronicle.queueRollCycleformat

Popular methods of RollCycle

  • current
  • length
  • toCycle
  • toIndex
  • defaultIndexCount
  • defaultIndexSpacing
  • toSequenceNumber

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Sublime Text 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