Class WatchServiceListener.Builder
- java.lang.Object
-
- org.spongepowered.configurate.reference.WatchServiceListener.Builder
-
- Enclosing class:
- WatchServiceListener
public static final class WatchServiceListener.Builder extends java.lang.Object
Set the parameters needed to create aWatchServiceListener
. All params are optional and defaults will be used if no values are specified.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WatchServiceListener
build()
Create a new listener, using default values for any unset parameters.WatchServiceListener.Builder
fileSystem(java.nio.file.FileSystem system)
Set the filesystem expected to be used for paths.WatchServiceListener.Builder
taskExecutor(java.util.concurrent.Executor executor)
Set the executor that will be used to execute tasks queued based on received events.WatchServiceListener.Builder
threadFactory(java.util.concurrent.ThreadFactory factory)
Set the thread factory that will be used to create the polling thread for the returned watch service.
-
-
-
Method Detail
-
threadFactory
public WatchServiceListener.Builder threadFactory(java.util.concurrent.ThreadFactory factory)
Set the thread factory that will be used to create the polling thread for the returned watch service.- Parameters:
factory
- the thread factory to use to create the deamon thread- Returns:
- this builder
- Since:
- 4.0.0
-
taskExecutor
public WatchServiceListener.Builder taskExecutor(java.util.concurrent.Executor executor)
Set the executor that will be used to execute tasks queued based on received events. By default, thecommon pool
is used.- Parameters:
executor
- the executor to use- Returns:
- this builder
- Since:
- 4.0.0
-
fileSystem
public WatchServiceListener.Builder fileSystem(java.nio.file.FileSystem system)
Set the filesystem expected to be used for paths. A separateWatchServiceListener
should be created to listen to events on each different file system.- Parameters:
system
- the file system to use.- Returns:
- this builder
- Since:
- 4.0.0
-
build
public WatchServiceListener build() throws java.io.IOException
Create a new listener, using default values for any unset parameters.- Returns:
- a newly created executor
- Throws:
java.io.IOException
- if thrown byWatchServiceListener
's constructor- Since:
- 4.0.0
-
-