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.activeio.journal.howl
Class HowlJournal

    java.lang.Object
      org.activeio.journal.howl.HowlJournal

All Implemented Interfaces:
  Journal

public class HowlJournal
extends java.lang.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.2 $

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.
`Packet` | `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(Packet packet, boolean sync)` Writes a `Packet` of data 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,
                       java.lang.ClassNotFoundException,
                       java.io.IOException,
                       java.lang.InterruptedException

Method Detail

### write

    public RecordLocation write(Packet packet,
                                boolean sync)
                         throws java.io.IOException

  Description copied from interface: `Journal`
  Writes a `Packet` of data to the journal. If `sync` is true, then this call blocks until the data has landed on the physical disk. Otherwise, this enqueues the write request and returns.

  Specified by:
    `write` in interface `Journal`
  Parameters:
    `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:
    `java.io.IOException` - if the write failed.
  See Also:
    `org.activeio.journal.Journal#write(byte[], boolean)`

### setMark

    public void setMark(RecordLocation recordLocator,
                        boolean force)
                 throws InvalidRecordLocationException,
                        java.io.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.
    `java.io.IOException` - if the record could not be read.
  See Also:
    `org.activeio.journal.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 java.io.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:
    `java.io.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:
    `org.activeio.journal.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:
    `org.activeio.journal.Journal#getNextRecordLocation(org.codehaus.activemq.journal.RecordLocation)`

### read

    public Packet read(RecordLocation location)
                throws InvalidRecordLocationException,
                       java.io.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:
    `java.io.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:
    `org.activeio.journal.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 © -2005 The ActiveIO Project. All Rights Reserved.