This project has retired. For details please refer to its Attic page.
Log.Writer
JavaScript is disabled on your browser.
Skip navigation links
org.apache.mesos

Class Log.Writer

  • Enclosing class:
    Log


    public static class Log.Writer
    extends java.lang.Object
    Provides write access to the Log. This class is not safe for use from multiple threads and instances should be thrown out after any Log.WriterFailedException is thrown.
    • Constructor Summary

      Constructors
      Constructor and Description
      Writer (Log log, long timeout, java.util.concurrent.TimeUnit unit, int retries)
      Constructs a writer linked the given Log.
    • Method Summary

      All Methods
      Modifier and Type Method and Description
      Log.Position append (byte[] data, long timeout, java.util.concurrent.TimeUnit unit)
      Attempts to append to the log with the specified data returning the new end position of the log if successful.
      protected void finalize ()
      protected void initialize (Log log, long timeout, java.util.concurrent.TimeUnit unit, int retries)
      Log.Position truncate (Log.Position to, long timeout, java.util.concurrent.TimeUnit unit)
      Attempts to truncate the log (from the beginning to the specified position exclusive) If the position is invalid, an Log.WriterFailedException will get thrown.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Writer

        public Writer(Log log,
         long timeout,
         java.util.concurrent.TimeUnit unit,
         int retries)
        Constructs a writer linked the given Log.
        Parameters:
        log - The log that this writer will access.
        timeout - Max number of time units to wait before a TimeoutException.
        unit - Type of time units used for the timeout, e.g. seconds, minutes, etc.
        retries - Number of retries
        See Also:
        TimeUnit
    • Method Detail

      • append

        public Log.Position append(byte[] data,
         long timeout,
         java.util.concurrent.TimeUnit unit)
         throws java.util.concurrent.TimeoutException,
         Log.WriterFailedException 
        Attempts to append to the log with the specified data returning the new end position of the log if successful.
        Parameters:
        data - Data to append to the log.
        timeout - Max number of time units to wait before a TimeoutException.
        unit - Type of time units used for the timeout, e.g. seconds, minutes, etc.
        Returns:
        The new end-position.
        Throws:
        java.util.concurrent.TimeoutException - If the append doesn't happen before the timeout.
        Log.WriterFailedException - If the append fails due that the writer no longer has the ability to perform its operations (e.g., because it was superseded by another writer).
        See Also:
        TimeUnit, Log.WriterFailedException
      • truncate

        public Log.Position truncate(Log.Position to,
         long timeout,
         java.util.concurrent.TimeUnit unit)
         throws java.util.concurrent.TimeoutException,
         Log.WriterFailedException 
        Attempts to truncate the log (from the beginning to the specified position exclusive) If the position is invalid, an Log.WriterFailedException will get thrown. Unfortunately, this will also get thrown in other circumstances (e.g., disk failure) and therefore it is currently impossible to tell these two cases apart.
        Parameters:
        to - The log will be truncated up to this point.
        timeout - Max number of time units to wait before a TimeoutException.
        unit - Type of time units used for the timeout, e.g. seconds, minutes, etc.
        Returns:
        The position after the truncation.
        Throws:
        java.util.concurrent.TimeoutException - If the truncation doesn't happen before the timeout.
        Log.WriterFailedException - If the truncation fails due an invalid position or if the writer no longer has the ability to perform its operations (e.g., because it was superseded by another writer).
      • initialize

        protected void initialize(Log log,
         long timeout,
         java.util.concurrent.TimeUnit unit,
         int retries)
      • finalize

        protected void finalize()
        Overrides:
        finalize in class java.lang.Object
Skip navigation links

AltStyle によって変換されたページ (->オリジナル) /