1Z0-804 · Question #63
An application is waiting for notification of changes to a tmp directory using the following code statements: Path dir = Paths.get("tmp") WatchKey key = dir.register (watcher, ENTRY_CREATE…
The correct answer is D. The events received and the order of events are platform dependent. The implementation that observes events from the file system is intended to map directly on to the native file event notification facility where available, or to use a primitive mechanism, such as polling, when a native facility is not available. Consequently, many of the…
Question
An application is waiting for notification of changes to a tmp directory using the following code statements:
Path dir = Paths.get("tmp") WatchKey key = dir.register (watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY) ; In the tmp directory, the user renames the file testA to testB, Which statement is true?
Options
- AThe events received and the order of events are consistent across all platforms.
- BThe events received and the order of events are consistent across all Microsoft Windows versions.
- CThe events received and the order of events are consistent across all UNIX platforms.
- DThe events received and the order of events are platform dependent.
How the community answered
(44 responses)- A11% (5)
- B7% (3)
- C5% (2)
- D77% (34)
Explanation
The implementation that observes events from the file system is intended to map directly on to the native file event notification facility where available, or to use a primitive mechanism, such as polling, when a native facility is not available. Consequently, many of the details on how events are detected, their timeliness, and whether their ordering is preserved are highly implementation specific. For example, when a file in a watched directory is modified then it may result in a single ENTRY_MODIFY event in some implementations but several events in other implementations. Short-lived files (meaning files that are deleted very quickly after they are created) may not be detected by primitive implementations that periodically poll the file system to detect changes.
Topics
Community Discussion
No community discussion yet for this question.