final class WatchKey extends AnyRef
A token representing the registration of a watchable object with a WatchService
.
- Alphabetic
- By Inheritance
- WatchKey
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cancel(implicit trace: Trace): UIO[Unit]
Cancels the registration with the watch service.
Cancels the registration with the watch service. Upon return the watch key will be invalid. If the watch key is enqueued, waiting to be retrieved from the watch service, then it will remain in the queue until it is removed. Pending events, if any, remain pending and may be retrieved by invoking the pollEvents method after the key is cancelled. If this watch key has already been cancelled then invoking this method has no effect. Once cancelled, a watch key remains forever invalid.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isValid(implicit trace: Trace): UIO[Boolean]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pollEvents(implicit trace: Trace): UIO[List[WatchEvent[_]]]
Retrieves and removes all pending events for this watch key.
Retrieves and removes all pending events for this watch key.
This does not block, it will immediately return an empty list if there are no events pending. Typically, this key should be reset after processing the returned events, the
pollEventsScoped
method can be used to do this automatically and reliably. - def pollEventsScoped(implicit trace: Trace): ZIO[Scope, Nothing, List[WatchEvent[_]]]
Retrieves and removes all pending events for this watch key as a scoped resource.
Retrieves and removes all pending events for this watch key as a scoped resource.
This does not block, it will immediately return an empty list if there are no events pending. When the
Scope
is closed, this key will be reset. - def reset(implicit trace: Trace): UIO[Boolean]
Resets this watch key, making it eligible to be re-queued in the
WatchService
.Resets this watch key, making it eligible to be re-queued in the
WatchService
. A key is typically reset after all the pending events retrieved frompollEvents
have been processed. UsepollEventsScop[ed
to automatically and reliably perform a reset. - def resolveEventPath(event: WatchEvent[_]): Option[Path]
Convenience method to construct the complete path indicated by a
WatchEvent
.Convenience method to construct the complete path indicated by a
WatchEvent
.If both the following are true:
- This key's watchable is a filesystem path 2. The event has a path as its context
then this method returns a path with the event's path resolved against this key's path,
(key path) / (event path)
.If either of the above conditions don't hold,
None
is returned. The conditions will always hold when watching file system paths. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def watchable: Watchable
Returns the object for which this watch key was created.