Microsoft
Software
Hardware
Network
Question : Thread to monitor a queue, remove identical events like AWT does with multiple repaint requests
HI,
I am tyring to implement a worker thread that will monitor a queue and remove identical events thus leaving
only one event in the queue - eg say if there are multiple requests to turn on and off a switch in
a short period of time i only to process the last one.
I know the AWT thread in the JVM does this with multiple repaint requests in a short period of time
but i cannot find the algorithm anywhere.
At the moment i have a concurrentlinked queue that is served by a SAX parser object that parses
xml strings and creates corresponding events, there are many threads that insert events into
the queue, i have one consumer thread removing these events and putting them into a rule engine
but to save extra work i want to be able to remove multiple events of the same type.
Any ideas are most welcome.
James.
Answer : Thread to monitor a queue, remove identical events like AWT does with multiple repaint requests
If you're trying to have at most one event of each type in the queue at any one time, you could use a LinkedHashSet - then it'd all happen automcatically
Random Solutions
permissions changed after moving folder from one server to another
HP Driver Dowload problems
get latest file in the directory in unix
SQL Reporting Services - OnPrint event
Restarting a WPF application to apply updates
Operation Must Use an Updateable Query
can I use my hard drive with XP and data on it with a system with replaced motherboard ?
Editable dropdown list in ASP.net 3.5 using C#
Access 2010 VBA - determining which "Yes/No" boxes are checked on a continupus form
Draytek Vigor 2820 - x2 PPPOA ADSL connections