2 Replies Latest reply on Feb 10, 2009 6:52 AM by alesj

    Deployment callbacks fail on static methods

    jaikiran

      I was following this chapter on Deployment Callbacks http://www.jboss.org/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/ch13s02.html. Works fine except when the callback method is marked static. So if i have this:

      <bean name="MyRegistry" class="org.myapp.registry.MyRegistry">
      
       <incallback method="addToRegistry"/>
       <uncallback method="removeFromRegistry"/>
       </bean>
      


      public class MyRegistry
      {
      
       public static void addToRegistry(SomeType obj)
       {
       // do something
       }
      
       public static void removeFromRegistry(SomeType obj)
       {
       // do something
       }
      
      
      
      This fails with:

      Caused by: org.jboss.joinpoint.spi.JoinpointException: Method not found removeFromRegistry[null] for class org.myapp.registry.MyRegistry
       at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:399)
       at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:365)
       at org.jboss.joinpoint.plugins.Config.findMethodInfo(Config.java:334)
       at org.jboss.beans.metadata.plugins.AbstractCallbackMetaData.describeVisit(AbstractCallbackMetaData.java:182)
       ... 49 more


      Making those methods non-static gets it working. From what i see in the AbstractCallbackMetaData, it uses an API on jboss-reflect which does not look for static methods. The jboss-reflect does provide an overriden method allowing lookup of static methods. Is it intentional not to allow callbacks to static methods?