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

Thomas Diesler (JIRA) jira-events at lists.jboss.org
Wed Jun 19 03:50:21 EDT 2013


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

Thomas Diesler updated WFLY-1559:
---------------------------------

    Description: 
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.

  was:
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 if the Tx subsystem is not configured these services are not available in the OSGi service registry.
I see intermittent failures because the Tx services are not injected and suspect that this is due to a race condition in subsystem startup.


    
> 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