Top Description Inners Fields Constructors Methods
org.eclipse.jetty.util.resource

public Class FileSystemPool

extends Object
implements Dumpable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.component.Dumpable
Annotations
@ManagedObject:Pool of FileSystems used to mount Resources
Imports
java.io.Closeable, .IOException, java.net.URI, java.nio.file.FileSystem, .FileSystemAlreadyExistsException, .FileSystemNotFoundException, .FileSystems, .Files, .Path, .Paths, .ProviderNotFoundException, java.nio.file.attribute.FileTime, java.util.Collection, .HashMap, .Map, .Set, java.util.concurrent.atomic.AtomicInteger, org.eclipse.jetty.util.IO, .URIUtil, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, .ManagedOperation, org.eclipse.jetty.util.component.Dumpable, .DumpableCollection, org.eclipse.jetty.util.thread.AutoLock, org.slf4j.Logger, .LoggerFactory

TODO figure out if this should be a LifeCycle or not, how many instances of this class can reside in a JVM, who can call sweep and when.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static interface
FileSystemPool.Listener

Listener for pool events

public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, String>
public static final FileSystemPool
private FileSystemPool.Listener
private static final Logger
private final Map<URI, FileSystemPool.Bucket>
private final AutoLock

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
dump(Appendable
The appendable to dump to
out
,
String
The indent to apply after any new lines.
indent
)

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.

pack-priv int

Returns:

the reference count on that URI
getReferenceCount
(URI
the filesystem URI to fetch
fsUri
)

Only used to test the reference count value for a URI during unit testing.

pack-priv FileSystemPool.Mount
mount(URI uri)

public Collection<FileSystemPool.Mount>
private void
retain(URI fsUri, FileSystem fileSystem, FileSystemPool.Mount mount)

public void
setListener(FileSystemPool.Listener
the listener for pool events
listener
)

Set a listener on the FileSystemPool to monitor for pool events.

public void
private URI
private void
unmount(URI fsUri)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ENV_MULTIRELEASE_RUNTIMEback to summary
private static final Map<String, String> ENV_MULTIRELEASE_RUNTIME
INSTANCEback to summary
public static final FileSystemPool INSTANCE
listenerback to summary
private FileSystemPool.Listener listener
LOGback to summary
private static final Logger LOG
poolback to summary
private final Map<URI, FileSystemPool.Bucket> pool
poolLockback to summary
private final AutoLock poolLock

Constructor Detail

FileSystemPoolback to summary
private FileSystemPool()

Method Detail

dumpback to summary
public void dump(Appendable out, String indent) throws IOException

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Doc from org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.

Parameters
out:Appendable

The appendable to dump to

indent:String

The indent to apply after any new lines.

Annotations
@Override
Exceptions
IOException:
if unable to write to Appendable
getReferenceCountback to summary
pack-priv int getReferenceCount(URI fsUri)

Only used to test the reference count value for a URI during unit testing.

Parameters
fsUri:URI

the filesystem URI to fetch

Returns:int

the reference count on that URI

mountback to summary
pack-priv FileSystemPool.Mount mount(URI uri) throws IOException
mountsback to summary
public Collection<FileSystemPool.Mount> mounts()
Annotations
@ManagedAttribute:The mounted FileSystems
retainback to summary
private void retain(URI fsUri, FileSystem fileSystem, FileSystemPool.Mount mount)
setListenerback to summary
public void setListener(FileSystemPool.Listener listener)

Set a listener on the FileSystemPool to monitor for pool events.

Parameters
listener:FileSystemPool.Listener

the listener for pool events

sweepback to summary
public void sweep()
Annotations
@ManagedOperation:Sweep the pool for deleted mount points
impact:ACTION
toJarURIRootback to summary
private URI toJarURIRoot(URI uri)
unmountback to summary
private void unmount(URI fsUri)
org.eclipse.jetty.util.resource back to summary

private Class FileSystemPool.Bucket

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final AtomicInteger
private final FileSystem
private final FileTime
private final FileSystemPool.Mount
private final Path
private final long

Constructor Summary

AccessConstructor and Description
private
Bucket(URI fsUri, FileSystem fileSystem, FileSystemPool.Mount mount)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

counterback to summary
private final AtomicInteger counter
fileSystemback to summary
private final FileSystem fileSystem
lastModifiedTimeback to summary
private final FileTime lastModifiedTime
mountback to summary
private final FileSystemPool.Mount mount
pathback to summary
private final Path path
sizeback to summary
private final long size

Constructor Detail

Bucketback to summary
private Bucket(URI fsUri, FileSystem fileSystem, FileSystemPool.Mount mount)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.util.resource back to summary

public Interface FileSystemPool.Listener

Known Direct Implementers
org.eclipse.jetty.util.resource.FileSystemPool.StackLoggingListener

Listener for pool events

Method Summary

Modifier and TypeMethod and Description
public void
onClose(URI
the filesystem URI
fsUri
)

FileSystem URI exists in the pool and reached no references and has been closed

public void
onDecrement(URI
the filesystem URI
fsUri
)

FileSystem URI exists in the pool and its reference count is decremented

public void
onIncrement(URI
the filesystem URI
fsUri
)

FileSystem URI exists in the pool and its reference count is incremented

public void
onRetain(URI
the filesystem URI
fsUri
)

FileSystem URI is retained for the first time

Method Detail

onCloseback to summary
public void onClose(URI fsUri)

FileSystem URI exists in the pool and reached no references and has been closed

Parameters
fsUri:URI

the filesystem URI

onDecrementback to summary
public void onDecrement(URI fsUri)

FileSystem URI exists in the pool and its reference count is decremented

Parameters
fsUri:URI

the filesystem URI

onIncrementback to summary
public void onIncrement(URI fsUri)

FileSystem URI exists in the pool and its reference count is incremented

Parameters
fsUri:URI

the filesystem URI

onRetainback to summary
public void onRetain(URI fsUri)

FileSystem URI is retained for the first time

Parameters
fsUri:URI

the filesystem URI

org.eclipse.jetty.util.resource back to summary

public Class FileSystemPool.Mount

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable

Field Summary

Modifier and TypeField and Description
private final URI
private final Resource

Constructor Summary

AccessConstructor and Description
private
Mount(URI fsUri, Resource resource)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public Resource
root()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fsUriback to summary
private final URI fsUri
rootback to summary
private final Resource root

Constructor Detail

Mountback to summary
private Mount(URI fsUri, Resource resource)

Method Detail

closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
rootback to summary
public Resource root()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.util.resource back to summary

public Class FileSystemPool.StackLoggingListener

extends Object
implements Listener
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.util.resource.FileSystemPool.StackLoggingListener
All Implemented Interfaces
org.eclipse.jetty.util.resource.FileSystemPool.Listener

Show a StackTrace

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
onClose(URI
the filesystem URI
uri
)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onClose.

FileSystem URI exists in the pool and reached no references and has been closed

public void
onDecrement(URI
the filesystem URI
uri
)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onDecrement.

FileSystem URI exists in the pool and its reference count is decremented

public void
onIncrement(URI
the filesystem URI
uri
)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onIncrement.

FileSystem URI exists in the pool and its reference count is incremented

public void
onRetain(URI
the filesystem URI
uri
)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onRetain.

FileSystem URI is retained for the first time

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG

Constructor Detail

StackLoggingListenerback to summary
public StackLoggingListener()

Method Detail

onCloseback to summary
public void onClose(URI uri)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onClose.

Doc from org.eclipse.jetty.util.resource.FileSystemPool.Listener.onClose.

FileSystem URI exists in the pool and reached no references and has been closed

Parameters
uri:URI

the filesystem URI

Annotations
@Override
onDecrementback to summary
public void onDecrement(URI uri)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onDecrement.

Doc from org.eclipse.jetty.util.resource.FileSystemPool.Listener.onDecrement.

FileSystem URI exists in the pool and its reference count is decremented

Parameters
uri:URI

the filesystem URI

Annotations
@Override
onIncrementback to summary
public void onIncrement(URI uri)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onIncrement.

Doc from org.eclipse.jetty.util.resource.FileSystemPool.Listener.onIncrement.

FileSystem URI exists in the pool and its reference count is incremented

Parameters
uri:URI

the filesystem URI

Annotations
@Override
onRetainback to summary
public void onRetain(URI uri)

Implements org.eclipse.jetty.util.resource.FileSystemPool.Listener.onRetain.

Doc from org.eclipse.jetty.util.resource.FileSystemPool.Listener.onRetain.

FileSystem URI is retained for the first time

Parameters
uri:URI

the filesystem URI

Annotations
@Override