]
David Bosschaert edited comment on AS7-4244 at 4/17/12 7:01 AM:
----------------------------------------------------------------
What's the simplest way to wait for a service to appear? By creating a separate
service that depends on the first or is there a simpler API?
was (Author: bosschaert):
What's the simplest way to wait for a service to appear? By creating a separate
services that depends on the first or is there a simpler API?
Framework activate operation returns prematurely
------------------------------------------------
Key: AS7-4244
URL:
https://issues.jboss.org/browse/AS7-4244
Project: Application Server 7
Issue Type: Bug
Components: OSGi
Reporter: Thomas Diesler
Assignee: David Bosschaert
Fix For: 7.1.2.Final-redhat1
The current implementation
{code}
protected void executeRuntimeStep(OperationContext context, ModelNode operation)
throws OperationFailedException {
ServiceController<?> svc =
context.getServiceRegistry(false).getRequiredService(Services.FRAMEWORK_ACTIVE);
svc.setMode(Mode.ACTIVE);
context.completeStep();
}
{code}
activates the service without waiting for it to come up. As a result you may get
{code}
org.junit.ComparisonFailure: expected:<[1]> but was:<[0]>
at org.junit.Assert.assertEquals(Assert.java:125)
at org.junit.Assert.assertEquals(Assert.java:147)
at
org.jboss.as.test.integration.osgi.management.OSGiManagementTestCase.testFrameworkActivation(OSGiManagementTestCase.java:71)
[CLI-out] [standalone@10.16.95.126:9999 /]
/subsystem=osgi:read-attribute(name=startlevel)
[CLI-out] {
[CLI-out] "outcome" => "success",
[CLI-out] "result" => undefined,
[CLI-out] "response-headers" => {"process-state" =>
"reload-required"}
[CLI-out] }
[CLI-inp] /subsystem=osgi:activate
[CLI-out] [standalone@10.16.95.126:9999 /] /subsystem=osgi:activate
04:08:53,619 INFO [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread
1-8) JBossOSGi Framework Core - 1.2.0.Beta2
[CLI-out] {
[CLI-out] "outcome" => "success",
[CLI-out] "response-headers" => {"process-state" =>
"reload-required"}
[CLI-out] }
[CLI-inp] /subsystem=osgi:read-attribute(name=startlevel)
[CLI-out] [standalone@10.16.95.126:9999 /]
/subsystem=osgi:read-attribute(name=startlevel)
[CLI-out] {
[CLI-out] "outcome" => "success",
[CLI-out] "result" => 0,
[CLI-out] "response-headers" => {"process-state" =>
"reload-required"}
[CLI-out] }
04:08:55,746 INFO [org.jboss.osgi.framework.internal.StartLevelPlugin] (MSC service
thread 1-4) Starting bundles for start level: 1
04:08:55,752 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: javax.servlet.api:2.5.0.Final
04:08:55,755 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: osgi.enterprise:4.2.0.201003190513
04:08:55,782 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: org.apache.felix.log:1.0.0
04:08:55,840 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: org.apache.felix.configadmin:1.2.8
04:08:55,860 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: jboss-osgi-logging:1.0.0
04:08:55,868 INFO [org.jboss.osgi.framework.internal.HostBundleState] (MSC service
thread 1-4) Bundle started: jboss-as-osgi-configadmin:7.1.2.Final-SNAPSHOT
04:08:55,873 INFO [org.jboss.osgi.framework.internal.FrameworkActive] (MSC service
thread 1-4) OSGi Framework started
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: