Class AbstractSequentialFile
java.lang.Object
org.apache.activemq.artemis.core.io.AbstractSequentialFile
- All Implemented Interfaces:
SequentialFile
- Direct Known Subclasses:
AIOSequentialFile, NIOSequentialFile
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Fileprotected final SequentialFileFactoryprotected Fileprotected longprotected final AtomicLongprotected TimedBufferprotected final TimedBufferObserverInstead of having AIOSequentialFile implementing the Observer, I have done it on an inner class. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractSequentialFile(File directory, String file, SequentialFileFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcopyTo(SequentialFile newFileName) protected TimedBufferObserverfinal voiddelete()final booleanexists()final booleanfits(int size) protected FilegetFile()final StringReturns a nativeFileof the file underlying this sequential file.protected ByteBuffernewBuffer(int requiredCapacity, boolean zeroed) longposition()voidposition(long pos) final voidvoidsetTimedBuffer(TimedBuffer buffer) voidwrite(ActiveMQBuffer bytes, boolean sync) voidwrite(ActiveMQBuffer bytes, boolean sync, IOCallback callback) voidwrite(EncodingSupport bytes, boolean sync) voidwrite(EncodingSupport bytes, boolean sync, IOCallback callback) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SequentialFile
afterComplete, blockingWriteDirect, calculateBlockStart, cloneFile, close, fill, isOpen, map, open, open, read, read, size, sync, writeDirect, writeDirect
-
Field Details
-
file
-
directory
-
factory
-
fileSize
protected long fileSize -
position
-
timedBuffer
-
timedBufferObserver
Instead of having AIOSequentialFile implementing the Observer, I have done it on an inner class. This is the class returned to the factory when the file is being activated.
-
-
Constructor Details
-
AbstractSequentialFile
-
-
Method Details
-
createTimedBufferObserver
-
exists
public final boolean exists()- Specified by:
existsin interfaceSequentialFile
-
getFileName
- Specified by:
getFileNamein interfaceSequentialFile
-
delete
- Specified by:
deletein interfaceSequentialFile- Throws:
IOExceptionInterruptedExceptionActiveMQException
-
copyTo
- Specified by:
copyToin interfaceSequentialFile- Throws:
Exception
-
position
- Specified by:
positionin interfaceSequentialFile- Throws:
IOException- only declare exception due to signature. Sub-class needs it.
-
position
public long position()- Specified by:
positionin interfaceSequentialFile
-
renameTo
public final void renameTo(String newFileName) throws IOException, InterruptedException, ActiveMQException - Specified by:
renameToin interfaceSequentialFile- Throws:
IOExceptionInterruptedExceptionActiveMQException
-
close
- Specified by:
closein interfaceSequentialFile- Throws:
IOException- we declare throwing IOException because sub-classes need to do itInterruptedExceptionActiveMQException
-
fits
public final boolean fits(int size) - Specified by:
fitsin interfaceSequentialFile
-
setTimedBuffer
- Specified by:
setTimedBufferin interfaceSequentialFile
-
write
- Specified by:
writein interfaceSequentialFile- Throws:
IOException
-
write
public void write(ActiveMQBuffer bytes, boolean sync) throws IOException, InterruptedException, ActiveMQException - Specified by:
writein interfaceSequentialFile- Throws:
IOExceptionInterruptedExceptionActiveMQException
-
write
- Specified by:
writein interfaceSequentialFile
-
write
public void write(EncodingSupport bytes, boolean sync) throws InterruptedException, ActiveMQException - Specified by:
writein interfaceSequentialFile- Throws:
InterruptedExceptionActiveMQException
-
getFile
-
newBuffer
-
getJavaFile
Description copied from interface:SequentialFileReturns a nativeFileof the file underlying this sequential file.- Specified by:
getJavaFilein interfaceSequentialFile- Returns:
- a native
Fileof the file underlying this sequential file
-