public class Bootstrapper
extends java.lang.Object
Constructor and Description |
---|
Bootstrapper() |
Modifier and Type | Method and Description |
---|---|
static long |
getDefaultPollingInterval()
Retrieves the default polling interval.
|
static boolean |
isForcePollingEnabled() |
static Path |
newPath(java.io.File file)
Creates a new Path instance for a given File.
|
static WatchService |
newWatchService()
Creates a new WatchService.
|
static java.io.File |
pathToFile(Path path)
Gets the File that corresponds to the given path.
|
static void |
setDefaultPollingInterval(long pollInterval)
This method allows to set the default polling time interval for
new WatchService implementations that use polling.
|
static void |
setForcePollingEnabled(boolean forcePollingEnabled)
When force polling is enabled, the Bootstrapper's
newWatchService()
method will only produce polling watch services. |
public static WatchService newWatchService()
FileSystems.getDefault().newWatchService()
and
is not source-compatible to JDK7FileSystem.newWatchService()
,
FileSystems.getDefault()
public static Path newPath(java.io.File file)
file
- that a new Path is created forpublic static java.io.File pathToFile(Path path)
path
- Path for with to retreive the corresponding Filepublic static boolean isForcePollingEnabled()
public static void setForcePollingEnabled(boolean forcePollingEnabled)
newWatchService()
method will only produce polling watch services. This feature is mostly
useful for testing and debugging (and not not much else really).forcePollingEnabled
- true to enable force pollingpublic static void setDefaultPollingInterval(long pollInterval)
This method allows to set the default polling time interval for new WatchService implementations that use polling. Note that polling is only used on a few supported platforms when certain event kinds are used or on unsupported platforms (fallback implementation).
The polling interval determines how often a thread that calls
WatchService.take()
will wake up to check if files in the
watched directory have changed. Longer time intervals will make
a polling service less accurate, but costs less in CPU and disk
resources, while shorter time intervals lead to higher accuracy but
more consumed resources (up to the point where polling takes longer than
the set interval in which case the machine will become very slow).
pollInterval
- the polling time interval in millisecondspublic static long getDefaultPollingInterval()
setDefaultPollingInterval