1 22 package org.jboss.aspects.patterns.singleton; 23 24 import org.jboss.aop.joinpoint.ConstructorInvocation; 25 26 44 public class Singleton 45 { 46 private Object singleton; 47 48 public synchronized Object constructorAdvice(ConstructorInvocation invocation) throws Throwable  49 { 50 if (singleton == null) 51 singleton = invocation.invokeNext(); 52 return singleton; 53 } 54 } 55 | Popular Tags |