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
AsynchronousFile
open
in interface AsynchronousFile
maxIO
- 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.HornetQException
public void close() throws Exception
close
in interface AsynchronousFile
Exception
public void writeInternal(long positionToWrite, long size, ByteBuffer bytes) throws HornetQException
AsynchronousFile
writeInternal
in interface AsynchronousFile
HornetQException
public void write(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioCallback)
AsynchronousFile
write
in interface AsynchronousFile
public void read(long position, long size, ByteBuffer directByteBuffer, AIOCallback aioPackage) throws HornetQException
read
in interface AsynchronousFile
HornetQException
public long size() throws HornetQException
AsynchronousFile
size
in interface AsynchronousFile
HornetQException
public void fill(long position, int blocks, long size, byte fillChar) throws HornetQException
fill
in interface AsynchronousFile
HornetQException
public int getBlockSize()
getBlockSize
in interface AsynchronousFile
public String getFileName()
getFileName
in interface AsynchronousFile
public static ByteBuffer newBuffer(int size)
public void setBufferCallback(BufferCallback callback)
setBufferCallback
in interface AsynchronousFile
public 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.