Re: Can I control listener update frequency?

Carfield Yim <[email protected]> Thu, 7 Feb 2008 22:48:05 +0800
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
On 2/7/08, Peter Booth <[email protected]> wrote:
> Yes you can, and there are a couple of approaches. Note that SWT's
> event handling is different than Swings' in that in SWT we depend on
> the native windowing system to update the GUI. You may find SWT
> specific patterns/tools on an SWT site.
>
> How does your application get messages from your server?  Is it a
> callback mechanism or polling? Assuming it is a callback then you can
> use a producer/consumer to implement the "chunking" of events you
> desire. Your callback thread can write an event into a
> LinkedBlockingQueue or similar. The use from a Timer  periodically
> call queue.poll() until it returns null.
>

Yes.... forget about that, we can just do it in out application level.

> CAVEAT: Before doing any coding I would strongly urge that you use
> YourKit Profiler or OptimizeIt's ThreadDebugger to completely
> understand what is happening in your application when it is under
> load. It is very easy to have an incorrect belief about the concurrent
> behavior of your app and then waste time fixing something that isn't
> the actual problem. Some useful questions are:
>
> "how many is too many events returned from server? Does this number
> seem reasonable? If I put the application into this too busy state and
> produce a series of repeated thread dumps what do they show is
> occurring? Are we doing anything dumb in our event processing?"
>

It is reasonable, and would you please let me know some common
anti-pattern of event processing?

> Hope this helps.
>
Sure it help, thanks a lot!

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com