Using Java 7 I am trying to create an observer that monitors a data store (some type of collection) and then returns some elements from it at certain points. In this case, they are timestamps when the timestamp skips the current time, when I want it to be returned to the original thread. See code below.
@Override public void run() { while (!data.isEmpty()) { for (LocalTime dataTime : data) { if (new LocalTime().isAfter(dataTime)) {
I read about future and defiant ones, but they seem to stop the thread on return.
I donβt really want to return the value and stop the thread, and then start another task if you use the called, if that is not the best way.
What are the best methods to find this? It seems like such a wide selection.
thanks
source share