Package org.osgi.service.coordinator

Examples of org.osgi.service.coordinator.Coordination.fail()


        final MockParticipant p1 = new MockParticipant();
        c1.addParticipant(p1);
        assertTrue(c1.getParticipants().contains(p1));
        assertEquals(1, c1.getParticipants().size());

        c1.fail(new Exception());
        assertFalse(p1.ended);
        assertTrue(p1.failed);
        assertEquals(c1, p1.c);

        // assert order of call
View Full Code Here


        c2.addParticipant(p22);
        assertTrue(c2.getParticipants().contains(p21));
        assertTrue(c2.getParticipants().contains(p22));
        assertEquals(2, c2.getParticipants().size());

        c2.fail(new Exception());
        assertTrue(p21.failed);
        assertEquals(c2, p21.c);
        assertTrue(p22.failed);
        assertEquals(c2, p22.c);
        assertTrue("p22 must be called before p21", p22.time < p21.time);
View Full Code Here

        c3.addParticipant(p31); // should be "ignored"
        assertTrue(c3.getParticipants().contains(p31));
        assertTrue(c3.getParticipants().contains(p32));
        assertEquals(2, c3.getParticipants().size());

        c3.fail(new Exception());
        assertTrue(p31.failed);
        assertEquals(c3, p31.c);
        assertTrue(p32.failed);
        assertEquals(c3, p32.c);
        assertTrue("p31 must be called before p32", p32.time < p31.time);
View Full Code Here

      result = createSubsystem(ssr);
      checkLifecyclePermission(result);
      return (BasicSubsystem)ResourceInstaller.newInstance(coordination, result, parent).install();
    }
    catch (Throwable t) {
      coordination.fail(t);
    }
    finally {
      if (!embedded) {
        try {
          coordination.end();
View Full Code Here

          // appropriate.
          graph = new SubsystemGraph(root);
          ResourceInstaller.newInstance(coordination, root, root).install();
          populateRootSubsystem(root, coordination);
        } catch (Exception e) {
          coordination.fail(e);
        } finally {
          coordination.end();
        }
      }
      else {
View Full Code Here

                      DeploymentManifest.ARIESSUBSYSTEM_LASTID).getValue()));
          graph = new SubsystemGraph(root);
          ResourceInstaller.newInstance(coordination, root, root).install();
          populateRootSubsystem(root, coordination);
        } catch (Exception e) {
          coordination.fail(e);
        } finally {
          coordination.end();
        }
      }
    }
View Full Code Here

        Collections.sort(resources, new StartResourceComparator(header));
      for (Resource resource : resources)
        startResource(resource, coordination);
      target.setState(State.ACTIVE);
    } catch (Throwable t) {
      coordination.fail(t);
      // TODO Need to reinstate complete isolation by disconnecting the
      // region and transition to INSTALLED.
    } finally {
      try {
        coordination.end();
View Full Code Here

    Coordination coordination = Utils.createCoordination(subsystem);
    try {
      ResourceInstaller.newInstance(coordination, resource, subsystem).install();
    }
    catch (Throwable t) {
      coordination.fail(t);
    }
    finally {
      try {
        coordination.end();
      }
View Full Code Here

        assertNull(c1.getFailure());
        assertFalse(c1.isTerminated());
        assertTrue(c1.getParticipants().isEmpty());

        Exception cause = new Exception();
        assertTrue(c1.fail(cause));
        assertSame(cause, c1.getFailure());
        assertTrue(c1.isTerminated());
        assertNull(coordinator.peek());

        assertFalse(c1.fail(new Exception()));
View Full Code Here

        assertTrue(c1.fail(cause));
        assertSame(cause, c1.getFailure());
        assertTrue(c1.isTerminated());
        assertNull(coordinator.peek());

        assertFalse(c1.fail(new Exception()));
        try
        {
            c1.end();
            fail("Expected CoordinationException.FAILED on end() after fail()");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.