|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl
public class AsynchronousFileImpl
AsynchronousFile implementation
Constructor Summary | |
---|---|
AsynchronousFileImpl(java.util.concurrent.Executor writeExecutor,
java.util.concurrent.Executor pollerExecutor)
|
Method Summary | |
---|---|
static void |
addMax(int io)
|
static void |
clearBuffer(java.nio.ByteBuffer buffer)
|
void |
close()
|
static void |
destroyBuffer(java.nio.ByteBuffer buffer)
|
void |
fill(long position,
int blocks,
long size,
byte fillChar)
|
int |
getBlockSize()
|
java.lang.String |
getFileName()
|
long |
getHandler()
Return the JNI handler used on C++ |
static int |
getTotalMaxIO()
For test purposes |
static boolean |
isLoaded()
|
static void |
nanoSleep()
|
static java.nio.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(java.lang.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 |
void |
read(long position,
long size,
java.nio.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,
java.nio.ByteBuffer directByteBuffer,
AIOCallback aioCallback)
Any error will be reported on the callback interface |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AsynchronousFileImpl(java.util.concurrent.Executor writeExecutor, java.util.concurrent.Executor pollerExecutor)
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 handlersMethod Detail |
---|
public static void addMax(int io)
public static int getTotalMaxIO()
public static void resetMaxAIO()
public static boolean isLoaded()
public void open(java.lang.String fileName, int maxIO) throws MessagingException
AsynchronousFile
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.
MessagingException
public void close() throws java.lang.Exception
close
in interface AsynchronousFile
java.lang.Exception
public void write(long position, long size, java.nio.ByteBuffer directByteBuffer, AIOCallback aioCallback)
AsynchronousFile
write
in interface AsynchronousFile
public void read(long position, long size, java.nio.ByteBuffer directByteBuffer, AIOCallback aioPackage) throws MessagingException
read
in interface AsynchronousFile
MessagingException
public long size() throws MessagingException
AsynchronousFile
size
in interface AsynchronousFile
MessagingException
public void fill(long position, int blocks, long size, byte fillChar) throws MessagingException
fill
in interface AsynchronousFile
MessagingException
public int getBlockSize()
getBlockSize
in interface AsynchronousFile
public java.lang.String getFileName()
getFileName
in interface AsynchronousFile
public static java.nio.ByteBuffer newBuffer(int size)
size
-
public void setBufferCallback(BufferCallback callback)
setBufferCallback
in interface AsynchronousFile
public long getHandler()
public static void clearBuffer(java.nio.ByteBuffer buffer)
public static void destroyBuffer(java.nio.ByteBuffer buffer)
public static void setNanoSleepInterval(int nanoseconds)
public static void nanoSleep()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |