aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alasdair Nottingham <>
Subject Blueprint service reference damping
Date Sat, 06 Aug 2011 09:49:41 GMT

I've been hitting a few problems with blueprint recently due to the way the
blueprint service reference damping works. There are two problems that I
have hit:

   1. When a service goes away and is not replaced, such as on shutdown, if
   you "accidentally" call a service you get a, by default, 5 minute wait.
   2. As a user of a service proxy you need to cope with a
   ServiceUnavailableException. It is especially an issue with optional service
   and if you have a dynamic environment.

The first problem can be overcome by shortening the timeout, but you are
stuck with the second. I also have the proxy involving less code between me
and the service. In addition proxying service classes is harder.

For a while now I've been thinking of allowing a mode where you can get a
raw service injected instead of damped one. The problem is we are only
supposed to driver the setters once at bean creation, not multiple times.
After some thought I have an approach which I have proved. The approach is
that if the target setter takes an AtomicReference we will inject one of
those and replace the service in the reference behind the scenes. This means
you would write code like:

MyService s = injectedReference.get();
if (s != null) {;

rather than:;

it seems to work quite well. It only affects what is injected, binding
listeners still have the same behaviour as before. Since this change affects
the programming model somewhat I wanted to see what peoples thoughts were
before I committed it.


Alasdair Nottingham

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message