[jboss-jira] [JBoss JIRA] Commented: (JBMETA-27) Duplicate postConstruct lifecycle metadata for simple app client

Scott M Stark (JIRA) jira-events at lists.jboss.org
Sat Apr 26 16:34:08 EDT 2008


    [ http://jira.jboss.com/jira/browse/JBMETA-27?page=comments#action_12410838 ] 
            
Scott M Stark commented on JBMETA-27:
-------------------------------------

The problem is that the RemoteEnvironmentRefsGroupMetaData.merge is combining spec and jboss lifecycle methods:

   public void merge(RemoteEnvironment jbossEnv, RemoteEnvironment specEnv,
         String overrideFile, String overridenFile, boolean mustOverride)
   {
...
      if(jbossEnv != null)
      {
         postConstructs = addAll(postConstructs, jbossEnv.getPostConstructs());
         preDestroys = addAll(preDestroys, jbossEnv.getPreDestroys());
      }
      if(specEnv != null)
      {
         postConstructs = addAll(postConstructs, specEnv.getPostConstructs());
         preDestroys = addAll(preDestroys, specEnv.getPreDestroys());
      }

Instead of simple arrays, the lifecycle methods should be maps keyed by class name since a class may only have one post/pre-construct method.


> Duplicate postConstruct lifecycle metadata for simple app client
> ----------------------------------------------------------------
>
>                 Key: JBMETA-27
>                 URL: http://jira.jboss.com/jira/browse/JBMETA-27
>             Project: JBoss Metadata
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions:  1.0.0.Beta9
>            Reporter: Scott M Stark
>         Assigned To: Scott M Stark
>             Fix For: 1.0.0.Beta10
>
>
> I'm seeing 3 LifecycleCallbackMetaData postConstructs show up in the JBossClientMetaData for a simple client like the following. There should only be one.
> public class HelloWorldClient
> {
>    @EJB
>    private static HelloWorldService helloWorldService;
>    
>    @Resource(name="msg")
>    private static String msg;
>    
>    private static String result;
>    
>    @Resource(mappedName="ConnectionFactory")
>    private static ConnectionFactory connectionFactory;
>    
>    @Resource(name="messageReplier")
>    private static Destination destination;
>    
>    private static int postConstructCalls = 0;
>    
>    public static int getPostConstructCalls()
>    {
>       return postConstructCalls;
>    }
>    
> ...
>    @PostConstruct
>    public static void postConstruct()
>    {
>       postConstructCalls++;
>    }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list