[
https://issues.jboss.org/browse/WFCORE-3982?page=com.atlassian.jira.plugi...
]
Jeff Mesnil commented on WFCORE-3982:
-------------------------------------
[~ropalka] fiy, this issue will make sure that capabilities work with the new MSC Service
API
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)