public class AsynchronousFileImpl extends Object implements AsynchronousFile
| Constructor and Description |
|---|
AsynchronousFileImpl(Executor writeExecutor,
Executor pollerExecutor) |
AsynchronousFileImpl(Executor writeExecutor,
Executor pollerExecutor,
IOExceptionListener ioExceptionListener) |
| Modifier and Type | Method and Description |
|---|---|
static void |
addMax(int io) |
static void |
clearBuffer(ByteBuffer buffer) |
void |
close() |
static void |
closeFile(int handle) |
static void |
destroyBuffer(ByteBuffer buffer) |
void |
fill(long position,
int blocks,
long size,
byte fillChar) |
protected void |
finalize() |
int |
getBlockSize() |
String |
getFileName() |
ByteBuffer |
getHandler()
Return the JNI handler used on C++
|
static int |
getTotalMaxIO()
For test purposes
|
static boolean |
isLoaded() |
static FileLock |
lock(int handle) |
static void |
nanoSleep() |
static ByteBuffer |
newBuffer(int size)
This needs to be synchronized because of
http://bugs.sun.com/view_bug.do?bug_id=6791815
http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2009-January/000386.html
|
void |
open(String fileName,
int maxIO)
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
|
static int |
openFile(String fileName) |
void |
read(long position,
long size,
ByteBuffer directByteBuffer,
AIOCallback aioPackage) |
static void |
resetMaxAIO() |
void |
setBufferCallback(BufferCallback callback) |
static void |
setNanoSleepInterval(int nanoseconds)
Instead of passing the nanoSeconds through the stack call every time, we set it statically inside the native method
|
long |
size()
Warning: This function will perform a synchronous IO, probably translating to a fstat call
|
void |
write(long position,
long size,
ByteBuffer directByteBuffer,
AIOCallback aioCallback)
Any error will be reported on the callback interface
|
void |
writeInternal(long positionToWrite,
long size,
ByteBuffer bytes)
Performs an internal direct write.
|
public AsynchronousFileImpl(Executor writeExecutor, Executor pollerExecutor, IOExceptionListener ioExceptionListener)
writeExecutor - It needs to be a single Thread executor. If null it will use the user thread to execute write operationspollerExecutor - The thread pool that will initialize poller handlerspublic static void addMax(int io)
public static int getTotalMaxIO()
public static void resetMaxAIO()
public static boolean isLoaded()
public void open(String fileName, int maxIO) throws HornetQException
AsynchronousFileopen in interface AsynchronousFilemaxIO - The number of max concurrent asynchronous IO operations. It has to be balanced between the size of your writes and the capacity of your disk.HornetQExceptionpublic void close()
throws Exception
close in interface AsynchronousFileExceptionpublic void writeInternal(long positionToWrite,
long size,
ByteBuffer bytes)
throws HornetQException
AsynchronousFilewriteInternal in interface AsynchronousFileHornetQExceptionpublic void write(long position,
long size,
ByteBuffer directByteBuffer,
AIOCallback aioCallback)
AsynchronousFilewrite in interface AsynchronousFilepublic void read(long position,
long size,
ByteBuffer directByteBuffer,
AIOCallback aioPackage)
throws HornetQException
read in interface AsynchronousFileHornetQExceptionpublic long size()
throws HornetQException
AsynchronousFilesize in interface AsynchronousFileHornetQExceptionpublic void fill(long position,
int blocks,
long size,
byte fillChar)
throws HornetQException
fill in interface AsynchronousFileHornetQExceptionpublic int getBlockSize()
getBlockSize in interface AsynchronousFilepublic String getFileName()
getFileName in interface AsynchronousFilepublic static ByteBuffer newBuffer(int size)
public void setBufferCallback(BufferCallback callback)
setBufferCallback in interface AsynchronousFilepublic ByteBuffer getHandler()
public static void clearBuffer(ByteBuffer buffer)
public static FileLock lock(int handle)
public static int openFile(String fileName)
public static void closeFile(int handle)
public static void destroyBuffer(ByteBuffer buffer)
public static void setNanoSleepInterval(int nanoseconds)
public static void nanoSleep()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.