Class/Object

com.beachape.filemanagement

WatchServiceTask

Related Docs: object WatchServiceTask | package filemanagement

Permalink

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)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def contextAbsolutePath(key: WatchKey, contextPath: Path): Path

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. def run(): Unit

    Permalink

    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

    Permalink

    Stops the WatchService current

  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. def watch(path: Path, modifier: Option[Modifier], eventTypes: Kind[_]*): Option[WatchKey]

    Permalink

    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