journal.io.api
Class JournalBuilder

java.lang.Object
  extended by journal.io.api.JournalBuilder

public class JournalBuilder
extends Object

A builder style API to create ready to use Journal.


Method Summary
static JournalBuilder of(File directory)
           
 Journal open()
           
 JournalBuilder setArchived(File to)
          Set the directory used to archive cleaned up log files, also enabling archiving.
 JournalBuilder setChecksum(Boolean checksum)
          Set true to enable records checksum, false otherwise.
 JournalBuilder setDisposeInterval(Long disposeInterval)
          Set the milliseconds interval for resources disposal: i.e., un-accessed files will be closed.
 JournalBuilder setDisposer(ScheduledExecutorService disposer)
          Set the ScheduledExecutorService to use for internal resources disposing.
 JournalBuilder setFilePrefix(String filePrefix)
          Set the prefix for log files.
 JournalBuilder setFileSuffix(String fileSuffix)
          Set the suffix for log files.
 JournalBuilder setMaxFileLength(Integer maxFileLength)
          Set the max length of each log file.
 JournalBuilder setMaxWriteBatchSize(Integer maxWriteBatchSize)
          Set the max size in bytes of the write batch: must always be equal or less than the max file length.
 JournalBuilder setPhysicalSync(Boolean physicalSync)
          Set true if every disk write must be followed by a physical disk sync, synchronizing file descriptor properties and flushing hardware buffers, false otherwise.
 JournalBuilder setRecoveryErrorHandler(RecoveryErrorHandler recoveryErrorHandler)
          Set the RecoveryErrorHandler to invoke in case of checksum errors.
 JournalBuilder setReplicationTarget(ReplicationTarget replicationTarget)
          Set the ReplicationTarget to replicate batch writes to.
 JournalBuilder setWriter(Executor writer)
          Set the Executor to use for writing new record entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setArchived

public JournalBuilder setArchived(File to)
Set the directory used to archive cleaned up log files, also enabling archiving.


setChecksum

public JournalBuilder setChecksum(Boolean checksum)
Set true to enable records checksum, false otherwise.


setDisposeInterval

public JournalBuilder setDisposeInterval(Long disposeInterval)
Set the milliseconds interval for resources disposal: i.e., un-accessed files will be closed.


setDisposer

public JournalBuilder setDisposer(ScheduledExecutorService disposer)
Set the ScheduledExecutorService to use for internal resources disposing. Important note: the provided ScheduledExecutorService must be manually closed.


setFilePrefix

public JournalBuilder setFilePrefix(String filePrefix)
Set the prefix for log files.


setFileSuffix

public JournalBuilder setFileSuffix(String fileSuffix)
Set the suffix for log files.


setMaxFileLength

public JournalBuilder setMaxFileLength(Integer maxFileLength)
Set the max length of each log file.


setMaxWriteBatchSize

public JournalBuilder setMaxWriteBatchSize(Integer maxWriteBatchSize)
Set the max size in bytes of the write batch: must always be equal or less than the max file length.


setPhysicalSync

public JournalBuilder setPhysicalSync(Boolean physicalSync)
Set true if every disk write must be followed by a physical disk sync, synchronizing file descriptor properties and flushing hardware buffers, false otherwise.


setRecoveryErrorHandler

public JournalBuilder setRecoveryErrorHandler(RecoveryErrorHandler recoveryErrorHandler)
Set the RecoveryErrorHandler to invoke in case of checksum errors.


setReplicationTarget

public JournalBuilder setReplicationTarget(ReplicationTarget replicationTarget)
Set the ReplicationTarget to replicate batch writes to.


setWriter

public JournalBuilder setWriter(Executor writer)
Set the Executor to use for writing new record entries. Important note: the provided Executor must be manually closed.


open

public Journal open()
             throws IOException
Returns:
a configured and opened Journal
Throws:
IOException

of

public static JournalBuilder of(File directory)
Parameters:
directory -
Returns:
a JournalBuilder using directory as base directory


Copyright © 2013. All Rights Reserved.