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.
About Question enthuware.ocpjp.v7.2.1525 :
Moderator: admin
-
- Posts: 4
- Joined: Sat Aug 08, 2015 8:01 pm
- Contact:
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1525 :
Did you read the explanation provided with the question? It explains exactly what you are asking.
-
- Posts: 4
- Joined: Sat Aug 08, 2015 8:01 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1525 :
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?
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1525 :
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.
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.
-
- Site Admin
- Posts: 10385
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1525 :
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.
Who is online
Users browsing this forum: No registered users and 16 guests