|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.protocol.http.pagestore.FileChannelPool
public class FileChannelPool
Thread safe pool of FileChannel objects.
Opening and closing file is an expensive operation and under certain circumstances this can significantly harm performances, because on every close the file system cache might be flushed.
To minimize the negative impact opened files can be pooled, which is a responsibility of
FileChannelPool class.
FileChannelPool allows to specify maximum number of opened FileChannels.
Note that under certain circumstances (when there are no empty slots in pool) the initial capacity can be exceeded (more files are opened then the specified capacity is). If this happens, a warning is written to log, as this probably means that there is a problem with page store.
| Constructor Summary | |
|---|---|
FileChannelPool(int capacity)
Construct. |
|
| Method Summary | |
|---|---|
void |
closeAndDeleteFileChannel(java.lang.String name)
Closes the file channel with given name and removes it from pool. |
void |
destroy()
Destroys the FileChannel pool and closes all opened channels. |
java.nio.channels.FileChannel |
getFileChannel(java.lang.String fileName,
boolean createIfDoesNotExist)
Returns a channel for given file. |
void |
returnFileChannel(java.nio.channels.FileChannel channel)
Returns the channel to the pool. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileChannelPool(int capacity)
capacity - Maximum number of opened file channels.| Method Detail |
|---|
public java.nio.channels.FileChannel getFileChannel(java.lang.String fileName,
boolean createIfDoesNotExist)
returnFileChannel(FileChannel)
fileName - createIfDoesNotExist -
public void returnFileChannel(java.nio.channels.FileChannel channel)
getFileChannel(String, boolean).
channel - public void closeAndDeleteFileChannel(java.lang.String name)
name - public void destroy()
FileChannel pool and closes all opened channels.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||