[concurrency-interest] conditional put

Gregg Wonderly gergg at cox.net
Wed Nov 7 13:24:19 EST 2007

Gregg Wonderly wrote:
> You might also be able to use a 
> proxying delegate object to defer initialization, and then have it replace 
> itself in the map with the initialized reference so that the first use(s) will 
> be synchronized, but will then move away from that.
> public interface MyInterface {
> 	public void func1();
> 	public int func2();
> 	public String func3( int v);
> 	...etc...
> }
> public class MyProxy implements MyInterface {

And one other thing, is that I sometimes do this with an InvocationHandler and a 
  reflection generated Proxy when I have an interface.  The invocationHandler 
can then become a pretty generic solution for this, and you can create a factory 
interface for creating Proxy objects that use the correct InvocationHandler.

Gregg Wonderly

More information about the Concurrency-interest mailing list