mdw.sandStorm.lib.aDisk
Class AFileTPImpl
java.lang.Object
|
+--mdw.sandStorm.core.SimpleSink
|
+--mdw.sandStorm.lib.aDisk.AFileImpl
|
+--mdw.sandStorm.lib.aDisk.AFileTPImpl
- All Implemented Interfaces:
- ProfilableIF, QueueElementIF, SinkIF
- class AFileTPImpl
- extends AFileImpl
- implements QueueElementIF
This is an implementation of AFile which uses a pool of threads
which perform blocking I/O (through the java.io.RandomAccessFile
class) on files. This is a portable implementation but is not
intended to be high-performance.
- Author:
- Matt Welsh
- See Also:
AFile
Field Summary |
(package private) java.io.RandomAccessFile |
raf
|
Constructor Summary |
(package private) |
AFileTPImpl(AFile afile,
java.lang.String fname,
SinkIF compQ,
boolean create,
boolean readOnly,
AFileTPTM tm)
Create an AFileTPIMpl with the given AFile, filename, completion
queue, create/readOnly flags, and Thread Manager. |
Method Summary |
void |
close()
Close the file after all enqueued requests have completed. |
boolean |
enqueue_lossy(QueueElementIF req)
Enqueues the given request (which must be an AFileRequest)
to the file. |
void |
enqueue_many(QueueElementIF[] elements)
Enqueues the given requests (which must be AFileRequests)
to the file. |
void |
enqueue(QueueElementIF req)
Enqueues the given request (which must be an AFileRequest)
to the file. |
void |
flush()
Causes a SinkFlushedEvent to be posted on the file's completion queue
when all pending requests have completed. |
(package private) QueueIF |
getQueue()
Return the per-file event queue. |
(package private) AFileStat |
stat()
Return information on the properties of the file. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
raf
java.io.RandomAccessFile raf
AFileTPImpl
AFileTPImpl(AFile afile,
java.lang.String fname,
SinkIF compQ,
boolean create,
boolean readOnly,
AFileTPTM tm)
throws java.io.IOException
- Create an AFileTPIMpl with the given AFile, filename, completion
queue, create/readOnly flags, and Thread Manager.
enqueue
public void enqueue(QueueElementIF req)
throws SinkException
- Enqueues the given request (which must be an AFileRequest)
to the file.
- Overrides:
enqueue
in class AFileImpl
- Following copied from interface:
mdw.sandStorm.api.SinkIF
- Parameters:
element
- The QueueElementIF
to enqueue- Throws:
SinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.
enqueue_lossy
public boolean enqueue_lossy(QueueElementIF req)
- Enqueues the given request (which must be an AFileRequest)
to the file.
- Overrides:
enqueue_lossy
in class AFileImpl
- Following copied from interface:
mdw.sandStorm.api.SinkIF
- Parameters:
element
- The QueueElementIF
to enqueue- Returns:
- true if the element was enqueued, false otherwise.
enqueue_many
public void enqueue_many(QueueElementIF[] elements)
throws SinkException
- Enqueues the given requests (which must be AFileRequests)
to the file.
- Overrides:
enqueue_many
in class AFileImpl
- Following copied from interface:
mdw.sandStorm.api.SinkIF
- Parameters:
elements
- The element array to enqueue- Throws:
SinkFullException
- Indicates that the sink is temporarily full.SinkClosedException
- Indicates that the sink is
no longer being serviced.
stat
AFileStat stat()
- Return information on the properties of the file.
- Overrides:
stat
in class AFileImpl
close
public void close()
- Close the file after all enqueued requests have completed.
Disallows any additional requests to be enqueued on this file.
A SinkClosedEvent will be posted on the file's completion queue
when the close is complete.
- Overrides:
close
in class AFileImpl
flush
public void flush()
- Causes a SinkFlushedEvent to be posted on the file's completion queue
when all pending requests have completed.
- Overrides:
flush
in class AFileImpl
getQueue
QueueIF getQueue()
- Return the per-file event queue.