J
Jason Cavett
I have an interesting problem and I'm wondering if anybody has ever
run across it.
Part of the application I am developing is a BlockingQueue which waits
for an object to be placed on the queue. When the object is placed on
the queue, the object is taken off the blocking queue and actions are
performed on it.
The problem is that the object can be added to the BlockingQueue many
times in quick succession. Additionally, the actions performed on the
object take awhile to complete (and is pretty processor intensive -
even though the task is on a different thread). What I am wondering
is whether or not there is a way to keep taking the object (as it
changes -- it's always the same object, though) off the BlockingQueue
and assigning it to a variable but waiting for "X" to happen where "X"
is the system sits idle or something like that (which allows the user
to make many updates and THEN the checks are determined).
Other than a few things I found while searching, I haven't found a
whole lot. Any help pointing me in the right direction would be
great.
P.S. It seems like Eclipse does something like this between quick
compiles - the user types a bunch of stuff out, but Eclipse only
performs the compile/check/etc. when the user stops for a period of
time.
run across it.
Part of the application I am developing is a BlockingQueue which waits
for an object to be placed on the queue. When the object is placed on
the queue, the object is taken off the blocking queue and actions are
performed on it.
The problem is that the object can be added to the BlockingQueue many
times in quick succession. Additionally, the actions performed on the
object take awhile to complete (and is pretty processor intensive -
even though the task is on a different thread). What I am wondering
is whether or not there is a way to keep taking the object (as it
changes -- it's always the same object, though) off the BlockingQueue
and assigning it to a variable but waiting for "X" to happen where "X"
is the system sits idle or something like that (which allows the user
to make many updates and THEN the checks are determined).
Other than a few things I found while searching, I haven't found a
whole lot. Any help pointing me in the right direction would be
great.
P.S. It seems like Eclipse does something like this between quick
compiles - the user types a bunch of stuff out, but Eclipse only
performs the compile/check/etc. when the user stops for a period of
time.