axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Davis <>
Subject sync
Date Mon, 14 Oct 2002 21:16:26 GMT

One other thing I should point out - the scenario I was worried about (a
c'tor calling another service) isn't the only problem with the current
design.  If a c'tor is slow (or worse hangs) the current code will not
allow *any* other services (in the scope) to run.  The approach below at
least allows other services to be invoked.

Glen - got kicked off of irc but I think the problem would be solved by
something like this:
String lockObject = null ;
Object service = null ;
sync (session) {
  Hashtable  locks = session.get("AxisLocks");
  if ( locks == null )  session.set("AxisLocks", locks = new Hashtable() );
  if ( (lockObject = locks.get(serviceName)) == null )
    locks.put(serviceName, lockObject = new String(serviceName));  //
String can be anything
sync(lockObject) {
  service = session.get(serviceName);
  if ( service == null ) session.set(serviceName,

The first sync would only allow one thread to modify the locks hashtable at
a time - which is ok since the updates to the table would not be recursive
at all.  And the second sync would prevent multiple hits to the exact same
c'tor within the desired scope - rather than _any_ c'tor in the scope like
it is now.  So, this would lift the restriction that a c'tor can't call a
web service on the same server, but it won't allow the c'tor for a service
to invoke the same service - which I think would be ok - for now  :-).
Whatcha think?

View raw message