About Question enthuware.ocpjp.v7.2.1525 :

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

Moderator: admin

Post Reply
mchristiaan
Posts: 4
Joined: Sat Aug 08, 2015 8:01 pm
Contact:

About Question enthuware.ocpjp.v7.2.1525 :

Post by mchristiaan »

I'm using the book OCP Java SE 7 1ZO-804 from Mala Gupta - who writed the following in the book:

A WatchKey can be in multiple states:
■ Ready—A WatchKey is initially created with a ready state.
■ Signaled—When an event is detected, the WatchKey is signaled and queued. It can be retrieved using WatchService’s methods poll() or take().
■ Cancelled—Calling method cancel() on a WatchKey or closing the WatchService cancels a WatchKey.
■ Valid—A WatchKey in a ready or signaled state is in a valid state.

So she's saying that Valid is a state and you are saying Invalid maybe is a correct state? I'm confused.

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

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

Post by admin »

Did you read the explanation provided with the question? It explains exactly what you are asking.

mchristiaan
Posts: 4
Joined: Sat Aug 08, 2015 8:01 pm
Contact:

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

Post by mchristiaan »

If I didn't read it I wouldn't be asking about which one (Valid or Invalid state) is a correct state :S So to conclude by using your answer (the explanation) the book is stating it wrong?

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

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

Post by admin »

Well, the explanation clearly explains why we consider invalid as a state and also explains the ambiguity and contradiction involved in this matter.

You might want to ask the author of that book about their position. If they don't consider it a state, then only they can explain the reason behind their position.

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

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

Post by admin »

The explanation also refers you to official oracle article, which says,
A watch key has a state. At any given time, its state might be one of the following:

Ready indicates that the key is ready to accept events. When first created, a key is in the ready state.
Signaled indicates that one or more events are queued. Once the key has been signaled, it is no longer in the ready state until the reset method is invoked.
Invalid indicates that the key is no longer active. This state happens when one of the following events occurs:
The process explicitly cancels the key by using the cancel method.
The directory becomes inaccessible.
The watch service is closed.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests