Links

  • 1. Sogeti
  • 2. JBoss
  • 3. IBM
  • 4. Oracle
  • 5. SpringSource
  • 6. NL-JUG
  • 7. Java

Archives

Syndication  RSS 2.0

RSS 1.0
RSS 2.0

Bookmark this site

Add 'JCN Blog' site to delicious  Add 'JCN Blog' site to technorati  Add 'JCN Blog' site to digg  Add 'JCN Blog' site to dzone

Posted by Jan-Hendrik Kuperus at 6:18 on Thursday 5 November    Add 'Easy Event-Driven Application With Spring!' site to delicious  Add 'Easy Event-Driven Application With Spring!' site to technorati  Add 'Easy Event-Driven Application With Spring!' site to digg  Add 'Easy Event-Driven Application With Spring!' site to dzone

Suppose you are making an event-driven application. You have your listener interfaces and your event-generating objects. What is the most annoying part of getting this all to work?

Connecting your listeners to the event-generating objects. Every time you want some object to receive certain events, you have to register your listener with the correct producer object. This has some nasty effects on your code:

  • Either your listeners know to which object they are subscribing, or your event generators know who should be listening to their events
  • Due to this coupling, listeners and producers are difficult to test
  • Adding a new listener to your project requires some boilerplate code to get it working

Spring has a feature that can take care of all of this hassle: autowiring. For normal dependency injection, autowiring feels icky. It’s just too magical and leaves me with a feeling I am not in control. The great thing about autowiring is that it can be used on a per-method base.

Read the rest of this entry »

Posted by Hans-J├╝rgen Jacobs at 12:57 on Thursday 24 March    Add 'Flexible Event Delivery with Executors' site to delicious  Add 'Flexible Event Delivery with Executors' site to technorati  Add 'Flexible Event Delivery with Executors' site to digg  Add 'Flexible Event Delivery with Executors' site to dzone

Event-handling is critical to any GUI application, and many developers know the hazards of making a method call to unknown or poorly behaved code from the event-dispatch thread. J2SE 5.0′s concurrency utilities offer more fine-grained control over how code executes. Andrew Thompson applies that to offer better ways to handle events. [onjava.com]


© 2020 Java Competence Network. All Rights Reserved.