Examples of QuiesceParticipant


Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

    tm.begin();
   
    emf.createEntityManager().getProperties();
   
    //Quiesce the Unit, nothing should happen
    QuiesceParticipant participant = getParticipant("org.apache.aries.jpa.container");
   
    MultiQuiesceCallback callback = new MultiQuiesceCallback();
   
    participant.quiesce(callback, Collections.singletonList(getBundle(
        "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle")));
   
    //Quiesce the context, still nothing
    participant = getParticipant("org.apache.aries.jpa.container.context");
   
    participant.quiesce(callback, Collections.singletonList(getBundle(
       "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle")));
   
    Thread.sleep(1000);
   
    assertFalse("Quiesce finished", callback.bundleClearedUp());
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

                        }, timeout, TimeUnit.MILLISECONDS);

                       
                        //Create callback objects for all participants
                        for( ServiceReference sr : serviceRefs ) {
                            QuiesceParticipant participant = (QuiesceParticipant) bundleContext.getService(sr);
                            participants.add(participant);
                            callbacks.add(new QuiesceCallbackImpl(bundlesToQuiesce, callbacks, future, timeoutFuture));
                        }
                       
                        //Quiesce each participant and wait for an interrupt from a callback
                        //object when all are quiesced, or the timeout to be reached
                        for( int i=0; i<participants.size(); i++ ) {
                            QuiesceParticipant participant = participants.get(i);
                            QuiesceCallbackImpl callback = callbacks.get(i);
                            participant.quiesce(callback, copyOfBundles);
                        }                       
                    }else{
                        for (Bundle b : bundlesToQuiesce) {
                            stopBundle(b, bundlesToQuiesce);
                        }
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

            Set<Bundle> copyOfBundles = new HashSet<Bundle>(bundlesToQuiesce);
            Timer timer = new Timer();
           
            //Create callback objects for all participants
            for( ServiceReference sr : serviceRefs ) {
              QuiesceParticipant participant = (QuiesceParticipant) bundleContext.getService(sr);
              participants.add(participant);
              callbacks.add(new QuiesceCallbackImpl(copyOfBundles, callbacks, timer));
            }
           
            //Quiesce each participant and wait for an interrupt from a callback
            //object when all are quiesced, or the timeout to be reached
            for( int i=0; i<participants.size(); i++ ) {
              QuiesceParticipant participant = participants.get(i);
              QuiesceCallbackImpl callback = callbacks.get(i);
              List<Bundle> participantBundles = new ArrayList<Bundle>();
              //deep copy
              for (Bundle b : copyOfBundles) {
                participantBundles.add(b);
              }
              participant.quiesce(callback, participantBundles);
            }
            timer.schedule(new TimerTask() {

              @Override
              public void run() {
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

   
    assertCorrectPersistenceProviderUsed(ctx, providerP101, 2);
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(extenderBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertCalledExactNumberOfTimes(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class), 1);
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

    EntityManager bravo = ((EntityManagerFactory) ctx.getService(ctx.getServiceReferences(
        EntityManagerFactory.class.getName(), "(osgi.unit.name=bravo)")[0])).createEntityManager();
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(extenderBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertNotCalled(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class));
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

    BundleContext ctx = preExistingBundleSetup();
    mgr.start(ctx);
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(persistenceBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertCalledExactNumberOfTimes(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class), 1);
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

   
    assertCorrectPersistenceProviderUsed(ctx, providerP101, 2);
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(persistenceBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertCalledExactNumberOfTimes(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class), 1);
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

    EntityManager bravo = ((EntityManagerFactory) ctx.getService(ctx.getServiceReferences(
        EntityManagerFactory.class.getName(), "(osgi.unit.name=bravo)")[0])).createEntityManager();
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(persistenceBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertNotCalled(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class));
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

    BundleContext ctx = preExistingBundleSetup();
    mgr.start(ctx);
   
    QuiesceCallback cbk = Skeleton.newMock(QuiesceCallback.class);
   
    QuiesceParticipant p = (QuiesceParticipant) ctx.getService(ctx.getServiceReference(QuiesceParticipant.class.getName()));
 
    p.quiesce(cbk, Collections.singletonList(extenderBundle));
   
    Thread.sleep(100);
   
    Skeleton.getSkeleton(cbk).assertCalledExactNumberOfTimes(new MethodCall(QuiesceCallback.class,
        "bundleQuiesced", Bundle[].class), 1);
View Full Code Here

Examples of org.apache.aries.quiesce.participant.QuiesceParticipant

          + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
        "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))", DEFAULT_TIMEOUT);
   
   
    //Quiesce it
    QuiesceParticipant participant = getParticipant("org.apache.aries.jpa.container.context");
   
    TestQuiesceCallback callback = new TestQuiesceCallback();
   
    participant.quiesce(callback, Collections.singletonList(getBundle(
        "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle")));
   
    Thread.sleep(1000);
   
    assertTrue("Quiesce not finished", callback.bundleClearedUp());
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.