Class JDBCSequentialFile
- java.lang.Object
-
- org.apache.activemq.artemis.jdbc.store.file.JDBCSequentialFile
-
- All Implemented Interfaces:
SequentialFile
public class JDBCSequentialFile extends Object implements SequentialFile
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMetaData(Object key, Object value)voidblockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer)Write directly to the file without using any intermediate buffer and wait completion.
IfreleaseBufferistruethe providedbytesshould be released throughSequentialFileFactory.releaseBuffer(ByteBuffer), if supported.intcalculateBlockStart(int position)SequentialFilecloneFile()voidclose()voidclose(boolean waitOnSync, boolean block)When closing a file from a finalize block, you cant wait on syncs or anything like that.voidcopyTo(SequentialFile cloneFile)voiddelete()booleanexists()voidfill(int size)booleanfits(int size)StringgetExtension()StringgetFilename()StringgetFileName()longgetId()FilegetJavaFile()Returns a native File of the file underlying this sequential file.ObjectgetMetaData(Object key)intinternalWrite(ActiveMQBuffer buffer, IOCallback callback)intinternalWrite(ActiveMQBuffer buffer, IOCallback callback, boolean append)booleanisOpen()ByteBuffermap(int position, long size)voidopen()voidopen(int maxIO, boolean useExecutor)The maximum number of simultaneous writes acceptedlongposition()voidposition(long pos)intread(ByteBuffer bytes)intread(ByteBuffer bytes, IOCallback callback)voidrenameTo(String newFileName)voidsetId(long id)voidsetTimedBuffer(TimedBuffer buffer)longsize()voidsync()voidwrite(ActiveMQBuffer bytes, boolean sync)voidwrite(ActiveMQBuffer bytes, boolean sync, IOCallback callback)voidwrite(ActiveMQBuffer bytes, boolean sync, IOCallback callback, boolean append)voidwrite(EncodingSupport bytes, boolean sync)voidwrite(EncodingSupport bytes, boolean sync, IOCallback callback)voidwriteDirect(ByteBuffer bytes, boolean sync)Write directly to the file without using intermediate any buffervoidwriteDirect(ByteBuffer bytes, boolean sync, IOCallback callback)Write directly to the file without using any buffer-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.io.SequentialFile
afterComplete
-
-
-
-
Method Detail
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceSequentialFile
-
exists
public boolean exists()
- Specified by:
existsin interfaceSequentialFile
-
open
public void open() throws Exception- Specified by:
openin interfaceSequentialFile- Throws:
Exception
-
open
public void open(int maxIO, boolean useExecutor) throws ExceptionDescription copied from interface:SequentialFileThe maximum number of simultaneous writes accepted- Specified by:
openin interfaceSequentialFile- Throws:
Exception
-
fits
public boolean fits(int size)
- Specified by:
fitsin interfaceSequentialFile
-
calculateBlockStart
public int calculateBlockStart(int position) throws Exception- Specified by:
calculateBlockStartin interfaceSequentialFile- Throws:
Exception
-
getFileName
public String getFileName()
- Specified by:
getFileNamein interfaceSequentialFile
-
fill
public void fill(int size) throws Exception- Specified by:
fillin interfaceSequentialFile- Throws:
Exception
-
map
public ByteBuffer map(int position, long size) throws IOException
- Specified by:
mapin interfaceSequentialFile- Throws:
IOException
-
delete
public void delete() throws IOException, InterruptedException, ActiveMQException- Specified by:
deletein interfaceSequentialFile- Throws:
IOExceptionInterruptedExceptionActiveMQException
-
internalWrite
public int internalWrite(ActiveMQBuffer buffer, IOCallback callback)
-
internalWrite
public int internalWrite(ActiveMQBuffer buffer, IOCallback callback, boolean append)
-
write
public void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback, boolean append) throws Exception
- Throws:
Exception
-
write
public void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws Exception
- Specified by:
writein interfaceSequentialFile- Throws:
Exception
-
write
public void write(ActiveMQBuffer bytes, boolean sync) throws Exception
- Specified by:
writein interfaceSequentialFile- Throws:
Exception
-
write
public void write(EncodingSupport bytes, boolean sync, IOCallback callback) throws Exception
- Specified by:
writein interfaceSequentialFile- Throws:
Exception
-
write
public void write(EncodingSupport bytes, boolean sync) throws Exception
- Specified by:
writein interfaceSequentialFile- Throws:
Exception
-
writeDirect
public void writeDirect(ByteBuffer bytes, boolean sync, IOCallback callback)
Description copied from interface:SequentialFileWrite directly to the file without using any buffer- Specified by:
writeDirectin interfaceSequentialFile- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).
-
blockingWriteDirect
public void blockingWriteDirect(ByteBuffer bytes, boolean sync, boolean releaseBuffer)
Description copied from interface:SequentialFileWrite directly to the file without using any intermediate buffer and wait completion.
IfreleaseBufferistruethe providedbytesshould be released throughSequentialFileFactory.releaseBuffer(ByteBuffer), if supported.- Specified by:
blockingWriteDirectin interfaceSequentialFile- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). IfreleaseBufferistrueuse a buffer fromSequentialFileFactory.newBuffer(int),SequentialFileFactory.allocateDirectBuffer(int)otherwise.sync- iftruewill durable flush the written data on the file,falseotherwisereleaseBuffer- iftruewill release the buffer,falseotherwise
-
writeDirect
public void writeDirect(ByteBuffer bytes, boolean sync) throws Exception
Description copied from interface:SequentialFileWrite directly to the file without using intermediate any buffer- Specified by:
writeDirectin interfaceSequentialFile- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
Exception
-
read
public int read(ByteBuffer bytes, IOCallback callback) throws SQLException
- Specified by:
readin interfaceSequentialFile- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
SQLException
-
read
public int read(ByteBuffer bytes) throws Exception
- Specified by:
readin interfaceSequentialFile- Parameters:
bytes- the ByteBuffer must be compatible with the SequentialFile implementation (AIO or NIO). To be safe, use a buffer from the correspondingSequentialFileFactory.newBuffer(int).- Throws:
Exception
-
position
public void position(long pos) throws IOException- Specified by:
positionin interfaceSequentialFile- Throws:
IOException
-
position
public long position()
- Specified by:
positionin interfaceSequentialFile
-
close
public void close() throws Exception- Specified by:
closein interfaceSequentialFile- Throws:
Exception
-
close
public void close(boolean waitOnSync, boolean block) throws ExceptionDescription copied from interface:SequentialFileWhen closing a file from a finalize block, you cant wait on syncs or anything like that. otherwise the VM may hung. Especially on the testsuite.- Specified by:
closein interfaceSequentialFile- Throws:
Exception
-
sync
public void sync() throws IOException- Specified by:
syncin interfaceSequentialFile- Throws:
IOException
-
size
public long size() throws Exception- Specified by:
sizein interfaceSequentialFile- Throws:
Exception
-
renameTo
public void renameTo(String newFileName) throws Exception
- Specified by:
renameToin interfaceSequentialFile- Throws:
Exception
-
cloneFile
public SequentialFile cloneFile()
- Specified by:
cloneFilein interfaceSequentialFile
-
copyTo
public void copyTo(SequentialFile cloneFile) throws Exception
- Specified by:
copyToin interfaceSequentialFile- Throws:
Exception
-
getId
public long getId()
-
setId
public void setId(long id)
-
getFilename
public String getFilename()
-
getExtension
public String getExtension()
-
setTimedBuffer
public void setTimedBuffer(TimedBuffer buffer)
- Specified by:
setTimedBufferin interfaceSequentialFile
-
getJavaFile
public File getJavaFile()
Description copied from interface:SequentialFileReturns a native File of the file underlying this sequential file.- Specified by:
getJavaFilein interfaceSequentialFile
-
-