org.jboss.messaging.core.journal.impl
Class AIOSequentialFile

java.lang.Object
  extended by org.jboss.messaging.core.journal.impl.AIOSequentialFile
All Implemented Interfaces:
SequentialFile

public class AIOSequentialFile
extends java.lang.Object
implements SequentialFile

A AIOSequentialFile

Author:
Clebert Suconic

Constructor Summary
AIOSequentialFile(SequentialFileFactory factory, int bufferSize, long bufferTimeoutMilliseconds, java.lang.String journalDir, java.lang.String fileName, int maxIO, BufferCallback bufferCallback, java.util.concurrent.Executor executor, java.util.concurrent.Executor pollerExecutor)
           
 
Method Summary
 int calculateBlockStart(int position)
           
 void close()
           
 void delete()
           
 void fill(int position, int size, byte fillCharacter)
           
 boolean fits(int size)
           
 int getAlignment()
           
 java.lang.String getFileName()
           
 boolean isOpen()
           
 void lockBuffer()
           
protected  AsynchronousFile newFile()
          An extension point for tests
 void open()
           
 void open(int currentMaxIO)
          For certain operations (like loading) we don't need open the file with full maxIO
 long position()
           
 void position(long pos)
           
 int read(java.nio.ByteBuffer bytes)
           
 int read(java.nio.ByteBuffer bytes, IOCallback callback)
           
 void renameTo(java.lang.String fileName)
           
 void setBufferCallback(BufferCallback callback)
           
 void setTimedBuffer(TimedBuffer buffer)
           
 long size()
           
 void sync()
           
 java.lang.String toString()
           
 void unlockBuffer()
           
 void write(java.nio.ByteBuffer bytes, boolean sync)
           
 void write(java.nio.ByteBuffer bytes, boolean sync, IOCallback callback)
           
 void write(MessagingBuffer bytes, boolean sync)
           
 void write(MessagingBuffer bytes, boolean sync, IOCallback callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AIOSequentialFile

public AIOSequentialFile(SequentialFileFactory factory,
                         int bufferSize,
                         long bufferTimeoutMilliseconds,
                         java.lang.String journalDir,
                         java.lang.String fileName,
                         int maxIO,
                         BufferCallback bufferCallback,
                         java.util.concurrent.Executor executor,
                         java.util.concurrent.Executor pollerExecutor)
Method Detail

isOpen

public boolean isOpen()
Specified by:
isOpen in interface SequentialFile

getAlignment

public int getAlignment()
                 throws java.lang.Exception
Specified by:
getAlignment in interface SequentialFile
Throws:
java.lang.Exception

calculateBlockStart

public int calculateBlockStart(int position)
                        throws java.lang.Exception
Specified by:
calculateBlockStart in interface SequentialFile
Throws:
java.lang.Exception

fits

public boolean fits(int size)
Specified by:
fits in interface SequentialFile

lockBuffer

public void lockBuffer()
Specified by:
lockBuffer in interface SequentialFile

unlockBuffer

public void unlockBuffer()
Specified by:
unlockBuffer in interface SequentialFile

close

public void close()
           throws java.lang.Exception
Specified by:
close in interface SequentialFile
Throws:
java.lang.Exception

delete

public void delete()
            throws java.lang.Exception
Specified by:
delete in interface SequentialFile
Throws:
java.lang.Exception

fill

public void fill(int position,
                 int size,
                 byte fillCharacter)
          throws java.lang.Exception
Specified by:
fill in interface SequentialFile
Throws:
java.lang.Exception

getFileName

public java.lang.String getFileName()
Specified by:
getFileName in interface SequentialFile

open

public void open()
          throws java.lang.Exception
Specified by:
open in interface SequentialFile
Throws:
java.lang.Exception

renameTo

public void renameTo(java.lang.String fileName)
              throws java.lang.Exception
Specified by:
renameTo in interface SequentialFile
Throws:
java.lang.Exception

open

public void open(int currentMaxIO)
          throws java.lang.Exception
Description copied from interface: SequentialFile
For certain operations (like loading) we don't need open the file with full maxIO

Specified by:
open in interface SequentialFile
Throws:
java.lang.Exception

setBufferCallback

public void setBufferCallback(BufferCallback callback)

position

public void position(long pos)
              throws java.lang.Exception
Specified by:
position in interface SequentialFile
Throws:
java.lang.Exception

position

public long position()
              throws java.lang.Exception
Specified by:
position in interface SequentialFile
Throws:
java.lang.Exception

read

public int read(java.nio.ByteBuffer bytes,
                IOCallback callback)
         throws java.lang.Exception
Specified by:
read in interface SequentialFile
Throws:
java.lang.Exception

read

public int read(java.nio.ByteBuffer bytes)
         throws java.lang.Exception
Specified by:
read in interface SequentialFile
Throws:
java.lang.Exception

write

public void write(MessagingBuffer bytes,
                  boolean sync,
                  IOCallback callback)
           throws java.lang.Exception
Specified by:
write in interface SequentialFile
Throws:
java.lang.Exception

write

public void write(MessagingBuffer bytes,
                  boolean sync)
           throws java.lang.Exception
Specified by:
write in interface SequentialFile
Throws:
java.lang.Exception

write

public void write(java.nio.ByteBuffer bytes,
                  boolean sync,
                  IOCallback callback)
           throws java.lang.Exception
Specified by:
write in interface SequentialFile
Throws:
java.lang.Exception

write

public void write(java.nio.ByteBuffer bytes,
                  boolean sync)
           throws java.lang.Exception
Specified by:
write in interface SequentialFile
Throws:
java.lang.Exception

sync

public void sync()
          throws java.lang.Exception
Specified by:
sync in interface SequentialFile
Throws:
java.lang.Exception

size

public long size()
          throws java.lang.Exception
Specified by:
size in interface SequentialFile
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setTimedBuffer

public void setTimedBuffer(TimedBuffer buffer)

newFile

protected AsynchronousFile newFile()
An extension point for tests



Copyright © 2006 JBoss Inc. All Rights Reserved.