com.sun.jini.outrigger.snaplogstore
Class LogFile

java.lang.Object
  extended by com.sun.jini.outrigger.snaplogstore.LogFile
Direct Known Subclasses:
LogInputFile, LogOutputFile, SnapshotFile

 class LogFile
extends Object

The base class for the logging file classes. This class provides the common functionality, but you should not instantiate it.

(Note -- I use protected here as an advisory notice. Clearly, since this is package code, all classes in the package have access, but fields marked protected are expected to be used only by subclasses. Use good taste.)

Author:
Sun Microsystems, Inc.
See Also:
LogOutputFile, LogInputFile

Field Summary
protected static byte ABORT_OP
          A log entry that records a transaction abort.
protected  File baseDir
          The directory in which the log files live.
protected  String baseFile
          The base part of the file name (e.g., "log."
protected static byte BATCH_TAKE_OP
          A log entry that records a batch take.
protected static byte BATCH_WRITE_OP
          A log entry that records a batch write.
protected static byte BOOT_OP
          A log entry that records a boot.
protected static byte CANCEL_OP
          A log entry that records a cancel.
protected static byte COMMIT_OP
          A log entry that records a transaction commit.
protected static byte JOINSTATE_OP
          A log entry that records the join state.
(package private) static String LOG_TYPE
          The type of log stream
protected static int LOG_VERSION
          The version of the log stream (the highest one known).
private static Logger logger
          Logger for logging persistent store related information
protected static byte NOTIFIED_OP
          A log entry that records a notification and new sequence number.
protected static byte PREPARE_OP
          A log entry that records a transaction prepare.
protected static byte REGISTER_OP
          A log entry that records a notify.
protected static byte RENEW_OP
          A log entry that records a notify.
protected static byte TAKE_OP
          A log entry that records a take.
protected static byte UUID_OP
          A log entry that records the service's Uuid.
protected static byte WRITE_OP
          A log entry that records a write.
 
Constructor Summary
protected LogFile(File baseDir, String baseFile)
          Create a log file with the given base directory, base file name within the directory.
protected LogFile(String basePath)
          Create a log file from the given template.
 
Method Summary
(package private)  void destroy()
          Destroy all log files associated with this stream.
(package private)  int existingLogs(Collection files)
          Fill in a list of existing matching log files, oldest to newest, returning the highest number used as a suffix, or -1 if no files were found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseDir

protected File baseDir
The directory in which the log files live.


baseFile

protected String baseFile
The base part of the file name (e.g., "log." for "log.0", "log.1", ...)


LOG_TYPE

static final String LOG_TYPE
The type of log stream

See Also:
Constant Field Values

LOG_VERSION

protected static final int LOG_VERSION
The version of the log stream (the highest one known).

See Also:
Constant Field Values

BOOT_OP

protected static final byte BOOT_OP
A log entry that records a boot.

See Also:
Constant Field Values

JOINSTATE_OP

protected static final byte JOINSTATE_OP
A log entry that records the join state.

See Also:
Constant Field Values

WRITE_OP

protected static final byte WRITE_OP
A log entry that records a write.

See Also:
Constant Field Values

TAKE_OP

protected static final byte TAKE_OP
A log entry that records a take.

See Also:
Constant Field Values

REGISTER_OP

protected static final byte REGISTER_OP
A log entry that records a notify.

See Also:
Constant Field Values

RENEW_OP

protected static final byte RENEW_OP
A log entry that records a notify.

See Also:
Constant Field Values

NOTIFIED_OP

protected static final byte NOTIFIED_OP
A log entry that records a notification and new sequence number.

See Also:
Constant Field Values

CANCEL_OP

protected static final byte CANCEL_OP
A log entry that records a cancel.

See Also:
Constant Field Values

PREPARE_OP

protected static final byte PREPARE_OP
A log entry that records a transaction prepare.

See Also:
Constant Field Values

COMMIT_OP

protected static final byte COMMIT_OP
A log entry that records a transaction commit.

See Also:
Constant Field Values

ABORT_OP

protected static final byte ABORT_OP
A log entry that records a transaction abort.

See Also:
Constant Field Values

UUID_OP

protected static final byte UUID_OP
A log entry that records the service's Uuid.

See Also:
Constant Field Values

BATCH_WRITE_OP

protected static final byte BATCH_WRITE_OP
A log entry that records a batch write.

See Also:
Constant Field Values

BATCH_TAKE_OP

protected static final byte BATCH_TAKE_OP
A log entry that records a batch take.

See Also:
Constant Field Values

logger

private static final Logger logger
Logger for logging persistent store related information

Constructor Detail

LogFile

protected LogFile(File baseDir,
                  String baseFile)
Create a log file with the given base directory, base file name within the directory. This is intended only for when you are sure of the exact values -- no modifications are made to the values.


LogFile

protected LogFile(String basePath)
           throws IOException
Create a log file from the given template. If basePath has a directory component, it is used as the base directory. Otherwise the base directory is ".". If basePath names a directory, the base name will be "". Otherwise the file component is used as the base, with a "." added at the end if it is not already present.

Throws:
IOException
Method Detail

existingLogs

int existingLogs(Collection files)
Fill in a list of existing matching log files, oldest to newest, returning the highest number used as a suffix, or -1 if no files were found. If two files have the same time, they are sorted by the numeric value of the suffix.


destroy

void destroy()
Destroy all log files associated with this stream.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.