[jboss-jira] [JBoss JIRA] (WFLY-1559) Cannot reliably use optional service dependencies

David Lloyd (JIRA) jira-events at lists.jboss.org
Wed Jun 19 09:40:21 EDT 2013


     [ https://issues.jboss.org/browse/WFLY-1559?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Lloyd resolved WFLY-1559.
-------------------------------

    Resolution: Won't Fix


Optional dependencies are not recommended for use and are likely to be removed from MSC 2.  Dependencies between subsystems should not be modeled this way.
                
> Cannot reliably use optional service dependencies
> -------------------------------------------------
>
>                 Key: WFLY-1559
>                 URL: https://issues.jboss.org/browse/WFLY-1559
>             Project: WildFly
>          Issue Type: Bug
>          Components: MSC
>            Reporter: Thomas Diesler
>            Assignee: David Lloyd
>             Fix For: 8.0.0.Alpha2
>
>
> The OSGi transaction extension uses this code to define dependencies on some Tx services
> {code}
>             builder.addDependency(DependencyType.OPTIONAL, TransactionManagerService.SERVICE_NAME, TransactionManager.class, injectedTransactionManager);
>             builder.addDependency(DependencyType.OPTIONAL, UserTransactionService.SERVICE_NAME, UserTransaction.class, injectedUserTransaction);
> {code}
> and later registers OSGi services from it
> {code}
>         TransactionManager transactionManager = injectedTransactionManager.getOptionalValue();
>         if (transactionManager != null) {
>             systemContext.registerService(TransactionManager.class.getName(), transactionManager, null);
>         }
>         UserTransaction userTransaction = injectedUserTransaction.getOptionalValue();
>         if (userTransaction != null) {
>             systemContext.registerService(UserTransaction.class.getName(), userTransaction, null);
>         }
> {code}
> The intension is that the OSGi services only get registered when the Tx subsystem is configured.
> I see intermittent failures because the Tx services are not injected and suspect that this is due to a race condition in subsystem startup.

--
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


More information about the jboss-jira mailing list