4 Replies Latest reply on Jan 19, 2009 10:21 AM by jaikiran pai

    @depends annotation

    Renen W Newbie

      Hello,

      I have two annotated POJOs: ProcessManager and Logger. And, Logger depends on ProcessManager.

      Try as I might, they seem to deploy in the wrong sequence:

      22:38:41,148 INFO [STDOUT] Logger start
      22:38:41,154 INFO [STDOUT] Process manager starting...
      


      Which I don’t understand.

      The annotations are as follows:

      @Service (objectName="121:service=processManager")
      @Management(ProcessManager.class)
      @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED )
      public class ProcessManagerMBean implements ProcessManager {
      
       public void start() throws Exception {
       System.out.println("Process manager starting...");
      


      And:

      @Service (objectName="121:service=logger")
      @Depends ({"121:service=processManager"})
      @Management(Logger.class)
      @TransactionAttribute(TransactionAttributeType.NEVER )
      public class LoggerMBean implements Logger {
      
       public void start() throws Exception {
       System.out.println("Logger start");
      


      I have also tried injecting the dependency:

      @Service (objectName="121:service=logger")
      //@Depends ({"121:service=processManager"})
      @Management(Logger.class)
      @TransactionAttribute(TransactionAttributeType.NEVER )
      public class LoggerMBean implements Logger {
      
       @Depends("121:service=processManager")
       public ProcessManager processManager;
      
       public void start() throws Exception {
       System.out.println("Logger start");
      


      The injection happens, but the dependency is not managed.

      The wiki indicates that the start() methods should be called in dependency sequence...

      The complete extract of the logs is below.

      Any pointers would be warmly received!

      Thank you.

      22:38:39,298 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war
      22:38:40,907 INFO [JBossASKernel] Created KernelDeployment for: Services.jar
      22:38:40,913 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=121.ear,jar=Services.jar,name=LoggerMBean,service=EJB3
      22:38:40,913 INFO [JBossASKernel] with dependencies:
      22:38:40,913 INFO [JBossASKernel] and demands:
      22:38:40,913 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      22:38:40,913 INFO [JBossASKernel] 121:service=processManager
      22:38:40,913 INFO [JBossASKernel] and supplies:
      22:38:40,913 INFO [JBossASKernel] jndi:121/LoggerMBean/remote
      22:38:40,913 INFO [JBossASKernel] Class:za.co.oneTwoOne.services.Logger
      22:38:40,913 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=121.ear,jar=Services.jar,name=LoggerMBean,service=EJB3) to KernelDeployment of: Services.jar
      22:38:40,914 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=121.ear,jar=Services.jar,name=ProcessManagerMBean,service=EJB3
      22:38:40,914 INFO [JBossASKernel] with dependencies:
      22:38:40,914 INFO [JBossASKernel] and demands:
      22:38:40,914 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      22:38:40,914 INFO [JBossASKernel] and supplies:
      22:38:40,914 INFO [JBossASKernel] Class:za.co.oneTwoOne.services.ProcessManager
      22:38:40,914 INFO [JBossASKernel] jndi:121/ProcessManagerMBean/remote
      22:38:40,914 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=121.ear,jar=Services.jar,name=ProcessManagerMBean,service=EJB3) to KernelDeployment of: Services.jar
      22:38:41,015 INFO [EJBContainer] STARTED EJB: za.co.oneTwoOne.services.ProcessManagerMBean ejbName: ProcessManagerMBean
      22:38:41,022 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
      
      
      22:38:41,055 INFO [JBossASKernel] installing bean: 121:service=processManager
      22:38:41,056 INFO [JBossASKernel] with dependencies:
      22:38:41,056 INFO [JBossASKernel] and demands:
      22:38:41,056 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      22:38:41,056 INFO [JBossASKernel] and supplies:
      22:38:41,057 INFO [JBossASKernel] Class:za.co.oneTwoOne.services.ProcessManager
      22:38:41,057 INFO [JBossASKernel] jndi:121/ProcessManagerMBean/remote
      22:38:41,057 INFO [JBossASKernel] Installing bean(121:service=processManager) into kernel
      22:38:41,110 INFO [EJBContainer] STARTED EJB: za.co.oneTwoOne.services.LoggerMBean ejbName: LoggerMBean
      22:38:41,110 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:
      
      
      22:38:41,113 INFO [JBossASKernel] installing bean: 121:service=logger
      22:38:41,113 INFO [JBossASKernel] with dependencies:
      22:38:41,114 INFO [JBossASKernel] and demands:
      22:38:41,114 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
      22:38:41,114 INFO [JBossASKernel] 121:service=processManager
      22:38:41,114 INFO [JBossASKernel] and supplies:
      22:38:41,114 INFO [JBossASKernel] jndi:121/LoggerMBean/remote
      22:38:41,114 INFO [JBossASKernel] Class:za.co.oneTwoOne.services.Logger
      22:38:41,114 INFO [JBossASKernel] Installing bean(121:service=logger) into kernel
      22:38:41,148 INFO [STDOUT] Logger start
      22:38:41,154 INFO [STDOUT] Process manager starting...