Mercurial > projects > dwt-addons
diff dwtx/draw2d/RoutingAnimator.d @ 103:2d6540440fe6
Replace static ctors with lazy init.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 17:01:51 +0200 |
parents | 95307ad235d9 |
children |
line wrap: on
line diff
--- a/dwtx/draw2d/RoutingAnimator.d Sun Aug 03 03:07:30 2008 +0200 +++ b/dwtx/draw2d/RoutingAnimator.d Sun Aug 03 17:01:51 2008 +0200 @@ -37,10 +37,18 @@ */ public class RoutingAnimator : Animator , RoutingListener { -static const RoutingAnimator INSTANCE; -static this(){ - INSTANCE = new RoutingAnimator(); +private static RoutingAnimator INSTANCE_; +static RoutingAnimator INSTANCE(){ + if( INSTANCE_ is null ){ + synchronized( RoutingAnimator.classinfo ){ + if( INSTANCE_ is null ){ + INSTANCE_ = new RoutingAnimator(); + } + } + } + return INSTANCE_; } + /** * Constructs a routing animator for use with one or more connections. The default * instance ({@link #getDefault()} can be used on any number of connections.