Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.io.journal
Class FlashJournalRM.WriterDaemon.PendingWriteTask

java.lang.Object
  extended by com.tangosol.io.journal.FlashJournalRM.WriterDaemon.PendingWriteTask

All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
FlashJournalRM.WriterDaemon

protected class FlashJournalRM.WriterDaemon.PendingWriteTask
extends java.lang.Object
implements java.lang.Runnable

A task that gets queued to perform an asynchronous appending write on the WriterDaemon thread.


Constructor Summary
FlashJournalRM.WriterDaemon.PendingWriteTask(FlashJournalRM.JournalFile jrnlfile, FlashJournalRM.Buffer buf, int cbBuffer)
          Construct a PendingWriteInfo "struct".

 

Method Summary
protected  void processWriteException(java.io.IOException ioe, java.util.List listBuffer, java.nio.ByteBuffer[] aniobuf, FlashJournalRM.JournalFile jrnlfile)
          Process IOException while flushing the buffers to disk.
 void run()
          Execute the task, writing the buffer to the end of the file.
protected  void writeRemainder(java.io.IOException e, java.util.List listBuffer, java.nio.ByteBuffer[] aniobuf, boolean fSingleBlockWrite)
          Write what has not been written (remainder) to disk.
protected  boolean writeToFile(FlashJournalRM.JournalFile jrnlfile, java.nio.ByteBuffer[] aniobuf, java.util.List listBuffer, int cb)
          Write the provided buffers to the FlashJournalRM.JournalFile.

 

Constructor Detail

FlashJournalRM.WriterDaemon.PendingWriteTask

public FlashJournalRM.WriterDaemon.PendingWriteTask(FlashJournalRM.JournalFile jrnlfile,
                                                    FlashJournalRM.Buffer buf,
                                                    int cbBuffer)
Construct a PendingWriteInfo "struct".
Parameters:
jrnlfile - the file to append to
buf - the buffer to append
cbBuffer - the number of bytes to append from the buffer

Method Detail

run

public void run()
Execute the task, writing the buffer to the end of the file.
Specified by:
run in interface java.lang.Runnable

writeToFile

protected boolean writeToFile(FlashJournalRM.JournalFile jrnlfile,
                              java.nio.ByteBuffer[] aniobuf,
                              java.util.List listBuffer,
                              int cb)
Write the provided buffers to the FlashJournalRM.JournalFile. This method will reattempt writes if writes fully or partially fail via processWriteException(java.io.IOException, java.util.List, java.nio.ByteBuffer[], com.tangosol.io.journal.FlashJournalRM.JournalFile).
Parameters:
jrnlfile - the JournalFile the buffers should be written to
aniobuf - the NIO byte buffers to persist
listBuffer - the buffers maintained by the buffer pool
cb - the number of bytes to write
Returns:
true if the buffers where successfully written

processWriteException

protected void processWriteException(java.io.IOException ioe,
                                     java.util.List listBuffer,
                                     java.nio.ByteBuffer[] aniobuf,
                                     FlashJournalRM.JournalFile jrnlfile)
Process IOException while flushing the buffers to disk.

Upon encountering a write exception the write is reattempted with an increasing interval between attempts. This method switches the FlashJournalRM.CongestionPolicy allowing exceptions to be thrown to the client as the Journal naturally enters congestion.

Control may be returned to the caller with the Journal being unable to be repaired; this is highlighted by the throwing of a RuntimeException or the current thread's interrupt bit being set. In the latter case the Journal may wish to operate in a read-only mode.

Parameters:
ioe - the IOException
listBuffer - the list of buffers to be flushed to disk
aniobuf - the array of byte buffers to be flushed to disk
jrnlfile - the FlashJournalRM.JournalFile being written from
Throws:
java.lang.IllegalStateException - if the write could not be completed / repaired

writeRemainder

protected void writeRemainder(java.io.IOException e,
                              java.util.List listBuffer,
                              java.nio.ByteBuffer[] aniobuf,
                              boolean fSingleBlockWrite)
                       throws java.io.IOException
Write what has not been written (remainder) to disk. The remainder is derived based on current-buffers - bytes-written-to-file. This method is invoked as a result of some raw (device) error thus the exception argument. This ensures we do not lose the initial cause as we replay writes.
Parameters:
e - the IOException
listBuffer - the list of buffers to be flushed to disk
aniobuf - the array of byte buffers to be flushed to disk
fSingleBlockWrite - whether to switch the preference in favor of single block writes
Throws:
java.io.IOException

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.