1Z0-805J Free Dumps Study Materials
Question 6: どのステートメ ントは WatchService ンタフェースで定義されたテクの方法につい
ては真ですか。
A. 次のウォッチポキーを取得してから削除して、 または none の ヌルリターンは存在してい
ます。
B. 次のウォッチポキ ーを取得してか ら削除 します。キュー に入れ られたキーがす ぐに利 用
できない場合、プログラムは指定された待機時間を待ちます。
C. 次のウォッチポキ ーを取得してから削除 します: 何のキーがま だ存在しない場合は待 機し
ます。
D. 時計 キ ー のす べ ての 保 留 中の ベン ト を取 得 し てか ら 削除 し て、 取 得 され た ベ ン トの
リストを返します。
Correct Answer: C
Explanation:
The WatchKey take() method retrieves and removes next watch key, waiting if none are yet present.
Note: A watch service that watches registered objects for changes and events.
For example a file manager may use a watch service to monitor a directory for changes so that it can
update its display of the list of files when files are created or deleted. A Watchable object is
registered with a watch service by invoking its register method, returning a WatchKey to represent
the registration. When an event for an object is detected the key is signalled, and if not currently
signalled, it is queued to the watch service so that it can be retrieved by consumers that invoke the
poll or take methods to retrieve keys and process events. Once the events have been processed the
consumer invokes the key's reset method to reset the key which allows the key to be signalled and
re-queued with further events.
Reference: Interface WatchService