|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.abstracthorizon.mercury.maildir.file.SharedInputStreamPool
public class SharedInputStreamPool
Pool of shared input stream instance. Since each instance uses RandomAccessFile from java.io package it is important managing these resources.
Field Summary | |
---|---|
protected static SharedInputStreamPool |
defaultInstance
Pool default instance |
protected Set<javax.mail.internet.SharedInputStream> |
files
Set of opened SharedInputStreamImpl s |
protected int |
maxFiles
Maximum number of files |
protected int |
timeout
Timeout for removing not closed files |
Constructor Summary | |
---|---|
SharedInputStreamPool()
Default constructor. |
Method Summary | |
---|---|
protected void |
closed(SharedInputStreamImpl stream)
This is callback method used by SharedInputStreamImpl
to register that stream is now closed. |
void |
closeWithProvider(FileProvider provider)
Method that implicitly releases all RandomAccessFile s from all
streams that use given FileProvider |
static SharedInputStreamPool |
getDefaultInstance()
This method returns default instance |
SharedInputStreamImpl |
newStream(FileProvider fileProvider,
long start,
long len)
This method creates new SharedInputStreamImpl instance. |
protected void |
opened(SharedInputStreamImpl stream)
This is callback method used by SharedInputStreamImpl to register
that stream is now opened. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static SharedInputStreamPool defaultInstance
protected Set<javax.mail.internet.SharedInputStream> files
SharedInputStreamImpl
s
protected int maxFiles
protected int timeout
Constructor Detail |
---|
public SharedInputStreamPool()
Method Detail |
---|
public static SharedInputStreamPool getDefaultInstance()
public SharedInputStreamImpl newStream(FileProvider fileProvider, long start, long len)
SharedInputStreamImpl
instance.
fileProvider
- file providerstart
- start of the streamlen
- end of the stream
SharedInputStreamImpl
instanceprotected void opened(SharedInputStreamImpl stream)
SharedInputStreamImpl
to register
that stream is now opened. This is called each time RandomAccessFile
is created over the stream. It is possible for stream to be implicitly "clsoed"
and (re)opened several times.
stream
- stream that is openedprotected void closed(SharedInputStreamImpl stream)
SharedInputStreamImpl
to register that stream is now closed.
This is called each time RandomAccessFile
used by the stream is released.
It is possible for stream to be implicitly "clsoed"
and (re)opened several times.
stream
- stream that is closedpublic void closeWithProvider(FileProvider provider)
RandomAccessFile
s from all
streams that use given FileProvider
provider
- file provider whos SharedInputStreamImpl
belongs to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |