seda.sandStorm.lib.aDisk
Class AFileTPImpl

java.lang.Object
  extended byseda.sandStorm.core.SimpleSink
      extended byseda.sandStorm.lib.aDisk.AFileImpl
          extended byseda.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 seda.sandStorm.core.SimpleSink
enqueue_abort, enqueue_commit, enqueue_prepare, getEnqueuePredicate, profileSize, setEnqueuePredicate, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

raf

java.io.RandomAccessFile raf
Constructor Detail

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.

Method Detail

enqueue

public void enqueue(QueueElementIF req)
             throws SinkException
Enqueues the given request (which must be an AFileRequest) to the file.

Specified by:
enqueue in interface SinkIF
Specified by:
enqueue in class AFileImpl
Throws:
SinkException

enqueue_lossy

public boolean enqueue_lossy(QueueElementIF req)
Enqueues the given request (which must be an AFileRequest) to the file.

Specified by:
enqueue_lossy in interface SinkIF
Specified by:
enqueue_lossy in class AFileImpl

enqueue_many

public void enqueue_many(QueueElementIF[] elements)
                  throws SinkException
Enqueues the given requests (which must be AFileRequests) to the file.

Specified by:
enqueue_many in interface SinkIF
Specified by:
enqueue_many in class AFileImpl
Throws:
SinkException

stat

AFileStat stat()
Return information on the properties of the file.

Specified by:
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.

Specified by:
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.

Specified by:
flush in class AFileImpl

getQueue

QueueIF getQueue()
Return the per-file event queue.