class WatchServiceTask extends Runnable

WatchService class that implements a Run method for passing into a thread

Largely inspired by http://www.javacodegeeks.com/2013/04/watchservice-combined-with-akka-actors.html Takes care of registering paths to be monitored as well as logic that takes care of properly shutting down and monitoring the watcher thread

Linear Supertypes
Runnable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WatchServiceTask
  2. Runnable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WatchServiceTask(notifyActor: ActorRef)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. def contextAbsolutePath(key: WatchKey, contextPath: Path): Path

    Returns the absolute path for a given event.context().asInstancOf[Path] path taken from a WatchService event

    Returns the absolute path for a given event.context().asInstancOf[Path] path taken from a WatchService event

    This is actually taken from http://www.javacodegeeks.com/2013/04/watchservice-combined-with-akka-actors.html The way it works is a context is taken from the events originating from a WatchKey, which itself is registered to an actual watchable object. In this case, the watchable object is a Path. By using the watchable object as a path and calling resolve, passing in the relative path obtained from the context, we obtain the "full" relative-to-watchable path. Afterwards, toAbsolutePath is called to get the real absolute path.

    key

    WatchKey

    contextPath

    Path relative to the key's watchable

    returns

    Path

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def run(): Unit

    Not meant to be called directly

    Not meant to be called directly

    As an object that extends the Runnable interface, this method is required so that it can be passed into a Thread object and be run when #start is called on the thread object

    Definition Classes
    WatchServiceTask → Runnable
  17. def stopService(): Unit

    Stops the WatchService current

  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  23. def watch(path: Path, modifier: Option[Modifier], eventTypes: Kind[_]*): Option[WatchKey]

    Adds the path to the WatchService of this WatchServiceTask

    Adds the path to the WatchService of this WatchServiceTask

    This allows the thread running the run() method to do take() on the watchService to get a key for polling for events on registered paths

    path

    Path (Java7) path

    modifier

    Option[Modifier], the modifiers, if any, that modify how the object is registered

    eventTypes

    one or more WatchEvent.Kind[_], each being one of ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE

    returns

    Option[WatchKey] a Java7 WatchService WatchKey

Inherited from Runnable

Inherited from AnyRef

Inherited from Any

Ungrouped