Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.journal.howl
Class HowlJournal

    java.lang.Object
      org.codehaus.activemq.journal.howl.HowlJournal

All Implemented Interfaces:
  Journal

public class HowlJournal
extends Object
implements Journal

An implementation of the Journal interface using a HOWL logger. This is is a thin wrapper around a HOWL logger. This implementation can be used to write records but not to retreive them yet. Once the HOWL logger implements the methods needed to retreive previously stored records, this class can be completed.

Version:
  $Revision: 1.1 $

Constructor Summary
`HowlJournal(org.objectweb.howl.log.Configuration configuration)`

Method Summary
`void` | `close()` Close the Journal.
`RecordLocation` | `getMark()` Obtains the mark that was set in the Journal.
`RecordLocation` | `getNextRecordLocation(RecordLocation lastLocation)` Allows you to get the next RecordLocation after the `location` that is in the journal.
`byte[]` | `read(RecordLocation location)` Reads a previously written record from the journal.
`void` | `setJournalEventListener(JournalEventListener eventListener)` Registers a `JournalEventListener` that will receive notifications from the Journal.
`void` | `setMark(RecordLocation recordLocator, boolean force)` Informs the journal that all the journal space up to the `location` is no longer needed and can be reclaimed for reuse.
`RecordLocation` | `write(byte[] data, boolean sync)` Writes a byte array `record` to the journal.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HowlJournal

    public HowlJournal(org.objectweb.howl.log.Configuration configuration)
                throws org.objectweb.howl.log.InvalidFileSetException,
                       org.objectweb.howl.log.LogConfigurationException,
                       org.objectweb.howl.log.InvalidLogBufferException,
                       ClassNotFoundException,
                       IOException,
                       InterruptedException

Method Detail

### write

    public RecordLocation write(byte[] data,
                                boolean sync)
                         throws IOException

  Description copied from interface: `Journal`
  Writes a byte array `record` to the journal. If `sync` is true, then this call blocks until the data has landed on the physical disk. Otherwise, this call returns imeadiatly.

  Specified by:
    `write` in interface `Journal`
  Parameters:
    `data` - - the data to be written to disk.
    `sync` - - If this call should block until the data lands on disk.
  Returns:
    RecordLocation the location where the data will be written to on disk.
  Throws:
    `IOException` - if the write failed.
  See Also:
    `Journal.write(byte[], boolean)`

### setMark

    public void setMark(RecordLocation recordLocator,
                        boolean force)
                 throws InvalidRecordLocationException,
                        IOException

  Description copied from interface: `Journal`
  Informs the journal that all the journal space up to the `location` is no longer needed and can be reclaimed for reuse.

  Specified by:
    `setMark` in interface `Journal`
  Parameters:
    `recordLocator` - the location of the record to mark. All record locations before the marked location will no longger be vaild.
    `force` - if this call should block until the mark is set on the journal.
  Throws:
    `InvalidRecordLocationException` - if `location` parameter is out of range. It cannot be a location that is before the current mark.
    `IOException` - if the record could not be read.
  See Also:
    `Journal.setMark(org.codehaus.activemq.journal.RecordLocation, boolean)`

### getMark

    public RecordLocation getMark()

  Description copied from interface: `Journal`
  Obtains the mark that was set in the Journal.

  Specified by:
    `getMark` in interface `Journal`
  Returns:
    the mark that was set in the Journal.
  See Also:
    `Journal.getMark()`

### close

    public void close()
               throws IOException

  Description copied from interface: `Journal`
  Close the Journal. This is blocking operation that waits for any pending put opperations to be forced to disk. Once the Journal is closed, all other methods of the journal should throw IllegalStateException.

  Specified by:
    `close` in interface `Journal`
  Throws:
    `IOException` - if an error occurs while the journal is being closed.
  See Also:
    `Journal.close()`

### setJournalEventListener

    public void setJournalEventListener(JournalEventListener eventListener)

  Description copied from interface: `Journal`
  Registers a `JournalEventListener` that will receive notifications from the Journal.

  Specified by:
    `setJournalEventListener` in interface `Journal`
  Parameters:
    `eventListener` - object that will receive journal events.
  See Also:
    `Journal.setJournalEventListener(org.codehaus.activemq.journal.JournalEventListener)`

### getNextRecordLocation

    public RecordLocation getNextRecordLocation(RecordLocation lastLocation)
                                         throws InvalidRecordLocationException

  Description copied from interface: `Journal`
  Allows you to get the next RecordLocation after the `location` that is in the journal.

  Specified by:
    `getNextRecordLocation` in interface `Journal`
  Parameters:
    `lastLocation` - the reference location the is used to find the next location. To get the oldest location available in the journal, `location` should be set to null.
  Returns:
    the next record location
  Throws:
    `InvalidRecordLocationException` - if `location` parameter is out of range. It cannot be a location that is before the current mark.
  See Also:
    `Journal.getNextRecordLocation(org.codehaus.activemq.journal.RecordLocation)`

### read

    public byte[] read(RecordLocation location)
                throws InvalidRecordLocationException,
                       IOException

  Description copied from interface: `Journal`
  Reads a previously written record from the journal.

  Specified by:
    `read` in interface `Journal`
  Parameters:
    `location` - is where to read the record from.
  Returns:
    the data previously written at the `location`.
  Throws:
    `IOException` - if the record could not be read.
    `InvalidRecordLocationException` - if `location` parameter is out of range. It cannot be a location that is before the current mark.
  See Also:
    `Journal.read(org.codehaus.activemq.journal.RecordLocation)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.