Hi,

Ok, I'm a little confused now. I thought you asked how to make something a singleton--which is what I shared. Now you are saying that is not really what you need.

Without having any more details, I'm not sure how I can help you out further. If you can help me understand a bit better what it is you need, I can help you find a solution. Is it possible to use the actual code itself or is that an NDA or corporate secret? If not, can you get as similar as you possibly can without violating your employer's trust? I suspect that you may need another component to do aggregate work, or something of that nature. I'm not sure. When everything is called "component" its hard to understand what you are really trying to accomplish.

Excuse me, i'll try to explain in detail:
There ist the class NonThreadSafeComponent, which is used by several
requests to do some work. There ist a GeneratorA which uses the
ServiceManager to lookup this NonThreadSafeComponent an which calls some
methods on it. Then this NonThreadSafeComponent will be released.

void generate() {
  ntsc = serviceManager.lookup(NonThreadSafeComponent.ROLE);
   // do something exclusively on this component
  ntsc.call1();
  ntsc.call2();
  serviceManager.release(ntsc);
}

As the NonThreadSafeComponent uses some API which cannot be made
threadsafe, there can only be one method of NonThreadSafeComponent
executed at one time. I cannot change this API and it really has to be
used exclusively.

The behavoir i expected to get, is that
1) there is a single instance of NonThreadSafeComponent  which may be
looked up and be used by thread1
2) all other threads looking up this component will have to wait while
the thread1 executes some logic
3) after the thread1 releases the instance of NonThreadSafeComponent it
will be available to the next thread

(Part 2) should be done by the ServiceManager)

Thanks, Robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]