You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Doug Davis <du...@us.ibm.com> on 2002/10/14 23:07:20 UTC

sync





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,
service=getNewService(...));
}

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?
-Dug