[jboss-jira] [JBoss JIRA] (WFCORE-3982) Update Capability ServiceTarget/Builder to use the new Service API.
Richard Opalka (JIRA)
issues at jboss.org
Tue Jul 31 12:09:00 EDT 2018
[ https://issues.jboss.org/browse/WFCORE-3982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13612811#comment-13612811 ]
Richard Opalka commented on WFCORE-3982:
----------------------------------------
Yes, this is one of missing API bits in WFLY [~jmesnil].
> Update Capability ServiceTarget/Builder to use the new Service API.
> -------------------------------------------------------------------
>
> Key: WFCORE-3982
> URL: https://issues.jboss.org/browse/WFCORE-3982
> Project: WildFly Core
> Issue Type: Bug
> Components: Management
> Affects Versions: 6.0.0.Alpha4
> Reporter: Jeff Mesnil
> Assignee: Jeff Mesnil
>
> Capabilities provided by service are installed with org.jboss.as.controller.CapabilityServiceTarget#addCapability that uses the deprecated org.jboss.msc.service.Service API.
> It is not possible to provide a capability provided by the new org.jboss.msc.Service API.
> In particular, there is a chicken and egg issue between org.jboss.as.controller.CapabilityServiceTarget#addCapability that needs an instance of the service(and returns a CapabilityServiceBuilder) and org.jboss.msc.service.ServiceBuilder#provides that creates a Consumer instance to pass to the service instance before this one is set with org.jboss.msc.service.ServiceBuilder#setInstance.
> new workflow should be:
> {code}
> CapabilityServiceBuilder serviceBuilder = context.getCapabilityServiceTarget().addCapability(CAP_NAME);
> Consumer<MyValue> consumer = serviceBuilder.provides(CAP_NAME);
> Service myService = new MyService(consumer);
> serviceBuilder.setInstance(myService)
> .install();
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list