[jboss-user] [JBoss AOP] - Re: problem in granularity of interception

fabiocsilva do-not-reply at jboss.com
Thu Dec 7 20:28:11 EST 2006


"fabiocsilva" wrote : I am needing to intercept the call of a constructor in my application. 	
  | When the instantiation occurs within of a method called for the system executes correctly. However, the instantiation occurs, in fact, inside of a constructor of another object. This another object is singleton. In this case the pointcut is not running. What it can be?  
  | 
  |   | 
  |   | Running:
  |   | 
  |   | public class ServletInit extends HttpServlet {
  |   | 
  |   |    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  |   |     	EmployeeRecord er = new EmployeeRecord(null);
  |   |         ...
  |   |     }
  |   | }
  |   | 
  |   | 
  | 
  | 
  | 
  |   | ERROR:
  |   | 
  |   | 
  |   | public class ServletInit extends HttpServlet {
  |   | 
  |   |    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  |   |     	HealthWatcherFacade.getInstance();
  |   |         ...
  |   |     }
  |   | }
  |   | 
  |   | 
  |   | 
  |   | public class HealthWatcherFacade {
  |   | 	private static HealthWatcherFacade singleton; //padrao singleton
  |   | 	private ComplaintRecord complaintRecord;
  |   | 	private HealthUnitRecord healthUnitRecord;
  |   | 	private MedicalSpecialtyRecord specialtyRecord;
  |   | 	private DiseaseRecord diseaseRecord;		
  |   | 	private EmployeeRecord employeeRecord;
  |   | 
  |   | 	private HealthWatcherFacade() {		
  |   | 		complaintRecord = new ComplaintRecord(null);
  |   | 		healthUnitRecord = new HealthUnitRecord(null);
  |   | 		specialtyRecord = new MedicalSpecialtyRecord(null);
  |   | 		diseaseRecord = new DiseaseRecord(null);		
  |   | 		employeeRecord = new EmployeeRecord(null);
  |   | 	}
  |   | 	public synchronized static HealthWatcherFacade getInstance() {		
  |   | 		if (singleton == null) {
  |   | 			singleton = new HealthWatcherFacade();
  |   | 		}
  |   | 
  |   | 		return singleton;
  |   | 	}
  |   | ...
  |   | }
  |   | 
  |   | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992134#3992134

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992134



More information about the jboss-user mailing list