org.jboss.messaging.core.asyncio.impl
Class AsynchronousFileImpl

java.lang.Object
  extended by org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl
All Implemented Interfaces:
AsynchronousFile

public class AsynchronousFileImpl
extends java.lang.Object
implements AsynchronousFile

AsynchronousFile implementation

Author:
clebert.suconic@jboss.com Warning: Case you refactor the name or the package of this class You need to make sure you also rename the C++ native calls

Constructor Summary
AsynchronousFileImpl()
           
 
Method Summary
 void close()
           
 void destroyBuffer(java.nio.ByteBuffer buffer)
           
 void fill(long position, int blocks, long size, byte fillChar)
           
 int getBlockSize()
           
static int getTotalMaxIO()
          For test purposes
static boolean isLoaded()
           
 java.nio.ByteBuffer newBuffer(long size)
           
 void open(java.lang.String fileName, int maxIO, long timeout)
          Note: If you are using a native Linux implementation, maxIO can't be higher than what's defined on /proc/sys/fs/aio-max-nr, or you would get an error
 void read(long position, long size, java.nio.ByteBuffer directByteBuffer, AIOCallback aioPackage)
           
 long size()
          Warning: This function will perform a synchronous IO, probably translating to a fstat call
 void write(long position, long size, java.nio.ByteBuffer directByteBuffer, AIOCallback aioPackage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousFileImpl

public AsynchronousFileImpl()
Method Detail

getTotalMaxIO

public static int getTotalMaxIO()
For test purposes


isLoaded

public static boolean isLoaded()

open

public void open(java.lang.String fileName,
                 int maxIO,
                 long timeout)
Description copied from interface: AsynchronousFile
Note: If you are using a native Linux implementation, maxIO can't be higher than what's defined on /proc/sys/fs/aio-max-nr, or you would get an error

Specified by:
open in interface AsynchronousFile
maxIO - The number of max concurrent asynchrnous IO operations. It has to be balanced between the size of your writes and the capacity of your disk.

close

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

write

public void write(long position,
                  long size,
                  java.nio.ByteBuffer directByteBuffer,
                  AIOCallback aioPackage)
Specified by:
write in interface AsynchronousFile

read

public void read(long position,
                 long size,
                 java.nio.ByteBuffer directByteBuffer,
                 AIOCallback aioPackage)
Specified by:
read in interface AsynchronousFile

size

public long size()
Description copied from interface: AsynchronousFile
Warning: This function will perform a synchronous IO, probably translating to a fstat call

Specified by:
size in interface AsynchronousFile

fill

public void fill(long position,
                 int blocks,
                 long size,
                 byte fillChar)
Specified by:
fill in interface AsynchronousFile

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface AsynchronousFile

destroyBuffer

public void destroyBuffer(java.nio.ByteBuffer buffer)
Specified by:
destroyBuffer in interface AsynchronousFile

newBuffer

public java.nio.ByteBuffer newBuffer(long size)
Specified by:
newBuffer in interface AsynchronousFile


Copyright © 2006 JBoss Inc. All Rights Reserved.