About Question enthuware.ocpjp.v7.2.1519 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
fariz.siracli
Posts: 22
Joined: Mon Jul 06, 2015 11:45 am
Contact:

About Question enthuware.ocpjp.v7.2.1519 :

Post by fariz.siracli »

where can i read about WatchService and possible counts of events?



sumanenthu
Posts: 23
Joined: Sun Feb 21, 2016 10:12 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1519 :

Post by sumanenthu »

What do you exactly try to mean by "The counts for ENTRY_CREATE and ENTRY_DELETE are exactly 1"? Does it mean that at a time we can have only one entry_create event queued?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1519 :

Post by admin »

When you get a WatchEvent object, you can call its count() method to find out the number of times that event has occurred. However, if the event is for creation or deletion of a directory, then this method always returns 1.

Try playing with some sample code to understand this better: http://www.codejava.net/java-se/file-io ... ervice-api

insider
Posts: 29
Joined: Wed Apr 17, 2013 9:22 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1519 :

Post by insider »

In explanation:
WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events) throws IOException

Second argument is actually a vararg, should be "WatchEvent.Kind<?>... events".
https://docs.oracle.com/javase/7/docs/a ... hable.html

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests