Package org.apache.lucene.tests.mockfile
Class HandleLimitFS
- java.lang.Object
-
- java.nio.file.spi.FileSystemProvider
-
- org.apache.lucene.tests.mockfile.FilterFileSystemProvider
-
- org.apache.lucene.tests.mockfile.HandleTrackingFS
-
- org.apache.lucene.tests.mockfile.HandleLimitFS
-
public class HandleLimitFS extends HandleTrackingFS
FileSystem that throws exception if file handles in use exceeds a specified limit.- See Also:
HandleLimitFS.MaxOpenHandles
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
HandleLimitFS.MaxOpenHandles
An annotation
-
Field Summary
-
Fields inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
delegate, fileSystem, scheme
-
-
Constructor Summary
Constructors Constructor Description HandleLimitFS(FileSystem delegate, int limit)
Create a new instance, limiting the maximum number of open files tolimit
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
onClose(Path path, Object stream)
Called whenpath
is closed viastream
.protected void
onOpen(Path path, Object stream)
Called whenpath
is opened viastream
.-
Methods inherited from class org.apache.lucene.tests.mockfile.HandleTrackingFS
newAsynchronousFileChannel, newByteChannel, newDirectoryStream, newFileChannel, newInputStream, newOutputStream
-
Methods inherited from class org.apache.lucene.tests.mockfile.FilterFileSystemProvider
checkAccess, copy, createDirectory, createLink, createSymbolicLink, delete, deleteIfExists, getFileAttributeView, getFileStore, getFileSystem, getPath, getScheme, isHidden, isSameFile, move, newFileSystem, newFileSystem, onClose, readAttributes, readAttributes, readSymbolicLink, setAttribute, toDelegate, toString, wrapPath
-
Methods inherited from class java.nio.file.spi.FileSystemProvider
installedProviders
-
-
-
-
Constructor Detail
-
HandleLimitFS
public HandleLimitFS(FileSystem delegate, int limit)
Create a new instance, limiting the maximum number of open files tolimit
- Parameters:
delegate
- delegate filesystem to wrap.limit
- maximum number of open files.
-
-
Method Detail
-
onOpen
protected void onOpen(Path path, Object stream) throws IOException
Description copied from class:HandleTrackingFS
Called whenpath
is opened viastream
.- Specified by:
onOpen
in classHandleTrackingFS
- Parameters:
path
- Path that was openedstream
- Stream or Channel opened against the path.- Throws:
IOException
- if an I/O error occurs.
-
onClose
protected void onClose(Path path, Object stream) throws IOException
Description copied from class:HandleTrackingFS
Called whenpath
is closed viastream
.- Specified by:
onClose
in classHandleTrackingFS
- Parameters:
path
- Path that was closedstream
- Stream or Channel closed against the path.- Throws:
IOException
- if an I/O error occurs.
-
-