[
https://issues.apache.org/jira/browse/JCLOUDS-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13698770#comment-13698770
]
Ioannis Canellos commented on JCLOUDS-85:
-----------------------------------------
The exact same code runs both inside OSGi and outside OSGi. The commands
themselves are not tightly coupled with OSGi and all OSGi services are injected
to the commands via OSGi Blueprint (this is where injection takes place).
Outside OSGi there is no injection at all. The commands create everything they
need on their own.
Worths mentioning that the for each execution a new command object is created,
so I can't think of an elegant way of determining whether we need to
instantiate the class without having to check in every execution.
Even if we store the shell table factory inside the command session instead of
having it as a member variable, we would still need to check for every
execution if an instance of the factory stored exists inside the session (as we
could have multiple command sessions running, or have the command session
restarted etc).
> Avoid creating uneeded instance of PropertyShellTableFactory
> ------------------------------------------------------------
>
> Key: JCLOUDS-85
> URL: https://issues.apache.org/jira/browse/JCLOUDS-85
> Project: jclouds
> Issue Type: Improvement
> Components: jclouds-karaf
> Affects Versions: 1.7.0, 1.6.1, 1.5.11
> Reporter: Ioannis Canellos
>
> The story here is that we have 2 versions of the ShellTableFactory:
> i) OSGi aware
> ii) Property based
> Our commands always instantiate (ii) and may replace it with (i) when running
> inside OSGi.
> We should make sure that we instantiate (ii) only if no injection takes place
> (e.g. outside OSGi)
> This could be as simple as checking if the factory is null inside the
> doExecute method and then instantiating (ii).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira