org.apache.mesos
Class Log.Writer
java.lang.Object
org.apache.mesos.Log.Writer
- Enclosing class:
- Log
public static class Log.Writer
- extends 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.
|
Method Summary |
Log.Position |
append(byte[] data,
long timeout,
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,
TimeUnit unit,
int retries)
|
Log.Position |
truncate(Log.Position to,
long timeout,
TimeUnit unit)
Attempts to truncate the log (from the beginning to the
specified position exclusive) If the position is invalid, an
WriterFailedException will get thrown. |
Log.Writer
public Log.Writer(Log log,
long timeout,
TimeUnit unit,
int retries)
append
public Log.Position append(byte[] data,
long timeout,
TimeUnit unit)
throws TimeoutException,
Log.WriterFailedException
- Attempts to append to the log with the specified data returning
the new end position of the log if successful.
- Throws:
TimeoutException
Log.WriterFailedException
truncate
public Log.Position truncate(Log.Position to,
long timeout,
TimeUnit unit)
throws TimeoutException,
Log.WriterFailedException
- Attempts to truncate the log (from the beginning to the
specified position exclusive) If the position is invalid, an
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.
TODO(benh): Throw both OperationFailedException and
WriterFailedException to differentiate the need for a new
writer from a bad position, or a bad disk, etc.
- Throws:
TimeoutException
Log.WriterFailedException
initialize
protected void initialize(Log log,
long timeout,
TimeUnit unit,
int retries)
finalize
protected void finalize()
- Overrides:
finalize in class Object
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.