You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Derek Baum (JIRA)" <ji...@apache.org> on 2011/02/01 08:55:28 UTC

[jira] Created: (FELIX-2816) dependency manager calls init() twice

dependency manager calls init() twice
-------------------------------------

                 Key: FELIX-2816
                 URL: https://issues.apache.org/jira/browse/FELIX-2816
             Project: Felix
          Issue Type: Bug
          Components: Dependency Manager
            Reporter: Derek Baum



Log messages are placed at  the beginning of the component lifecycle methods (init, start, stop, destroy).
The number is the hashCode, which shows that init() is called twice on the same Object, without intervening stop() or destroy():

[Debug] [   ] MyServlet 1397120162 init: update=60
[Debug] [   ] MyServlet 1397120162 start: endpoint=/myservlet period=60 history=null
[Debug] [   ] MyServlet 1397120162 init: update=60
[Debug] [   ] MyServlet add: gx2
[Debug] [   ] MyServlet add: denzil

The component is created as follows:

		manager.add(createComponent()
				.setImplementation(MyServlet.class)
				.add(createConfigurationDependency()
						.setPropagate(true)
						.setPid(PID))
	            .add(createServiceDependency()
	            		.setService(HttpService.class).setRequired(true))
	            .add(createServiceDependency()
	            		.setService(UserAdmin.class).setRequired(true))
				.add(createServiceDependency()
						.setService(MyStateStore.class).setRequired(false)
						.setCallbacks("addStore", "removeStore"))
				.add(createServiceDependency()
						.setService(HistoryService.class).setRequired(false))
				.add(createServiceDependency()
						.setService(LogService.class).setRequired(false))
		);



-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (FELIX-2816) dependency manager calls init() twice

Posted by "Derek Baum (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Derek Baum resolved FELIX-2816.
-------------------------------

    Resolution: Invalid

This is is invalid. One of the calls was due to the Servlet init() method.

Thanks to  Xander Uiterlinden for pointing this out.
                
> dependency manager calls init() twice
> -------------------------------------
>
>                 Key: FELIX-2816
>                 URL: https://issues.apache.org/jira/browse/FELIX-2816
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>            Reporter: Derek Baum
>
> Log messages are placed at  the beginning of the component lifecycle methods (init, start, stop, destroy).
> The number is the hashCode, which shows that init() is called twice on the same Object, without intervening stop() or destroy():
> [Debug] [   ] MyServlet 1397120162 init: update=60
> [Debug] [   ] MyServlet 1397120162 start: endpoint=/myservlet period=60 history=null
> [Debug] [   ] MyServlet 1397120162 init: update=60
> [Debug] [   ] MyServlet add: gx2
> [Debug] [   ] MyServlet add: denzil
> The component is created as follows:
> 		manager.add(createComponent()
> 				.setImplementation(MyServlet.class)
> 				.add(createConfigurationDependency()
> 						.setPropagate(true)
> 						.setPid(PID))
> 	            .add(createServiceDependency()
> 	            		.setService(HttpService.class).setRequired(true))
> 	            .add(createServiceDependency()
> 	            		.setService(UserAdmin.class).setRequired(true))
> 				.add(createServiceDependency()
> 						.setService(MyStateStore.class).setRequired(false)
> 						.setCallbacks("addStore", "removeStore"))
> 				.add(createServiceDependency()
> 						.setService(HistoryService.class).setRequired(false))
> 				.add(createServiceDependency()
> 						.setService(LogService.class).setRequired(false))
> 		);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (FELIX-2816) dependency manager calls init() twice

Posted by "Xander Uiterlinden (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144113#comment-13144113 ] 

Xander Uiterlinden commented on FELIX-2816:
-------------------------------------------

This is most likely caused by overlapping init methods. One for the servlet init and one for the component lifecycle callback method. It can be resolved by specifying another name for the init callback for the component lifecycle by using the Component.setCallbacks method.
                
> dependency manager calls init() twice
> -------------------------------------
>
>                 Key: FELIX-2816
>                 URL: https://issues.apache.org/jira/browse/FELIX-2816
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>            Reporter: Derek Baum
>
> Log messages are placed at  the beginning of the component lifecycle methods (init, start, stop, destroy).
> The number is the hashCode, which shows that init() is called twice on the same Object, without intervening stop() or destroy():
> [Debug] [   ] MyServlet 1397120162 init: update=60
> [Debug] [   ] MyServlet 1397120162 start: endpoint=/myservlet period=60 history=null
> [Debug] [   ] MyServlet 1397120162 init: update=60
> [Debug] [   ] MyServlet add: gx2
> [Debug] [   ] MyServlet add: denzil
> The component is created as follows:
> 		manager.add(createComponent()
> 				.setImplementation(MyServlet.class)
> 				.add(createConfigurationDependency()
> 						.setPropagate(true)
> 						.setPid(PID))
> 	            .add(createServiceDependency()
> 	            		.setService(HttpService.class).setRequired(true))
> 	            .add(createServiceDependency()
> 	            		.setService(UserAdmin.class).setRequired(true))
> 				.add(createServiceDependency()
> 						.setService(MyStateStore.class).setRequired(false)
> 						.setCallbacks("addStore", "removeStore"))
> 				.add(createServiceDependency()
> 						.setService(HistoryService.class).setRequired(false))
> 				.add(createServiceDependency()
> 						.setService(LogService.class).setRequired(false))
> 		);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira