|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectname.pachler.nio.file.ext.Bootstrapper
public class Bootstrapper
The Bootstrapper is used to instantiate WatchService and Path instances. Because jpathwatch does not implement all the underlying infrastructure of JDK7's nio implementation, the non-standard Bootstrapper class is used for these chores.
Constructor Summary | |
---|---|
Bootstrapper()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bootstrapper()
Method Detail |
---|
public static WatchService newWatchService()
FileSystems.getDefault().newWatchService()
and
is not source-compatible to JDK7
FileSystem.newWatchService()
,
FileSystems.getDefault()
public static Path newPath(java.io.File file)
file
- that a new Path is created for
public static java.io.File pathToFile(Path path)
path
- Path for with to retreive the corresponding File
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |