Examples of Barrier


Examples of com.google.appengine.tools.pipeline.impl.model.Barrier

  public JobRecord queryJob(Key jobKey, JobRecord.InflationType inflationType)
      throws NoSuchObjectException {
    try {
      Entity entity = transactionallyQueryEntity(jobKey);
      JobRecord jobRecord = new JobRecord(entity);
      Barrier runBarrier = null;
      Barrier finalizeBarrier = null;
      Slot outputSlot = null;
      JobInstanceRecord jobInstanceRecord = null;
      switch (inflationType) {
        case FOR_RUN:
          runBarrier = queryBarrier(jobRecord.getRunBarrierKey(), true, true);
View Full Code Here

Examples of com.google.appengine.tools.pipeline.impl.model.Barrier

    if (startNewTransaction) {
      entity = transactionallyQueryEntity(barrierKey);
    } else {
      entity = queryEntity(barrierKey);
    }
    Barrier barrier = new Barrier(entity);
    if (inflate) {
      Collection<Barrier> barriers = new ArrayList<Barrier>(1);
      barriers.add(barrier);
      inflateBarriers(barriers);
    }
View Full Code Here

Examples of com.google.appengine.tools.pipeline.impl.model.Barrier

    Slot slot = new Slot(entity);
    if (inflate) {
      Map<Key, Entity> entities = getAll(slot.getWaitingOnMeKeys());
      Map<Key, Barrier> barriers = new HashMap<Key, Barrier>(entities.size());
      for (Map.Entry<Key, Entity> entry : entities.entrySet()) {
        barriers.put(entry.getKey(), new Barrier(entry.getValue()));
      }
      slot.inflate(barriers);
      inflateBarriers(barriers.values());
    }
    return slot;
View Full Code Here

Examples of com.google.appengine.tools.pipeline.impl.model.Barrier

    final Map<Key, Barrier> barriers = new HashMap<Key, Barrier>();
    final Map<Key, JobInstanceRecord> jobInstanceRecords = new HashMap<Key, JobInstanceRecord>();
    putAll(barriers, new Instantiator<Barrier>() {
      @Override
      public Barrier newObject(Entity entity) {
        return new Barrier(entity);
      }
    }, Barrier.DATA_STORE_KIND, rootJobKey);
    putAll(slots, new Instantiator<Slot>() {
      @Override
      public Slot newObject(Entity entity) {
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.Barrier

  private static final ProbabilityDistribution<Double> NORMAL = new NormalDistribution(0, 1);

  @Override
  public Function1D<StandardOptionDataBundle, Double> getPricingFunction(final EuropeanStandardBarrierOptionDefinition definition) {
    Validate.notNull(definition, "definition");
    final Barrier barrier = definition.getBarrier();
    final boolean isKnockIn = barrier.getKnockType() == KnockType.IN;
    final boolean isDown = barrier.getBarrierType() == BarrierType.DOWN;
    final double h = barrier.getBarrierLevel();
    final int phi = definition.isCall() ? 1 : -1;
    final double eta = isDown ? 1 : -1;
    return new Function1D<StandardOptionDataBundle, Double>() {

      @SuppressWarnings("synthetic-access")
View Full Code Here

Examples of com.sun.enterprise.ee.server.group.Barrier

     * send notifications about the messaging status.
     */
    public void initiateMessagingAndWait(String key,
    Message.Route route, CallBack cb) {              
       
        Barrier b = initiateMessaging(key, route, cb);
        if (b != null) {
            b.start();        
        }       
       
    }
View Full Code Here

Examples of com.sun.enterprise.ee.server.group.Barrier

                setContextClassLoader(saved);
               
                //During load, aggregate the results. So, all the instances
                //will send the notification to the elected instnace. So, the
                //route is ALLTOONE.
                Barrier b = getServerMessageRuntime().initiateMessaging(appName,
                Message.Route.ALLTOONE,impl);
               
                if (b != null)
                    b.start(timeout);
            }
           
            return;
        }   
       
        if (event.getEventType() == ApplicationEvent.BEFORE_APPLICATION_UNLOAD){                  
            ApplicationLoadEventListener loaderListener = __handleEvent(event);
            String appName = event.getApplication().getRegistrationName();
            if (loaderListener != null) {
                MessageCallBackImpl impl =
                new MessageCallBackImpl(loaderListener);
                // In case of unload, an ONETOALL message should be sent so that
                // all instances will wait for clusterwide uload to complete.
                // FIX ME. Would ALLTOONE be better here also?
                getServerMessageRuntime().initiateMessagingAndWait(appName,
                Message.Route.ONETOALL,impl);               

                ClassLoader toSet = loaderListener.getClass().getClassLoader();
                ClassLoader saved = setContextClassLoader(toSet);
                loaderListener.handleUnLoad();
                setContextClassLoader(saved);

                //Lets make sure that message runtime doesnt keep this app any more.
                getServerMessageRuntime().purge(appName);
            }
            return;
        }  
       
        if (event.getEventType() == ApplicationEvent.APPLICATION_LOADFAIL) {
            ApplicationLoadEventListener loaderListener = __handleEvent(event);
            String appName = event.getApplication().getRegistrationName();
            if (loaderListener != null) {
                MessageCallBackImpl impl =
                new MessageCallBackImpl(loaderListener);
                impl.setFailure(true);

                ClassLoader toSet = loaderListener.getClass().getClassLoader();
                ClassLoader saved = setContextClassLoader(toSet);
                // Invoke the per-instance listener.
                loaderListener.handleLoadFailure();           
                setContextClassLoader(saved);
           
                //ALLTOONE message to aggregate failure messages.
                Barrier b = getServerMessageRuntime().initiateMessaging
                (appName+"__fail", Message.Route.ALLTOONE, impl);
               
                if (b != null)
                    b.start(timeout);               
            }
            return;
        }   
    }
View Full Code Here

Examples of org.antlr.misc.Barrier

      }
    }
    else {
      ErrorManager.info("two-threaded DFA conversion");
      // create a barrier expecting n DFA and this main creation thread
      Barrier barrier = new Barrier(3);
      // assume 2 CPU for now
      int midpoint = numDecisions/2;
      NFAConversionThread t1 =
        new NFAConversionThread(this, barrier, 1, midpoint);
      new Thread(t1).start();
      if ( midpoint == (numDecisions/2) ) {
        midpoint++;
      }
      NFAConversionThread t2 =
        new NFAConversionThread(this, barrier, midpoint, numDecisions);
      new Thread(t2).start();
      // wait for these two threads to finish
      try {
        barrier.waitForRelease();
      }
      catch(InterruptedException e) {
        ErrorManager.internalError("what the hell? DFA interruptus", e);
      }
    }
View Full Code Here

Examples of org.antlr.misc.Barrier

      }
    }
    else {
      ErrorManager.info("two-threaded DFA conversion");
      // create a barrier expecting n DFA and this main creation thread
      Barrier barrier = new Barrier(3);
      // assume 2 CPU for now
      int midpoint = numDecisions/2;
      NFAConversionThread t1 =
        new NFAConversionThread(this, barrier, 1, midpoint);
      new Thread(t1).start();
      if ( midpoint == (numDecisions/2) ) {
        midpoint++;
      }
      NFAConversionThread t2 =
        new NFAConversionThread(this, barrier, midpoint, numDecisions);
      new Thread(t2).start();
      // wait for these two threads to finish
      try {
        barrier.waitForRelease();
      }
      catch(InterruptedException e) {
        ErrorManager.internalError("what the hell? DFA interruptus", e);
      }
    }
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.Barrier

        // helper thread. The main thread uses it to tell the helper thread
        // that it has started the index scan. The helper thread uses it
        // to tell the main thread that it has locked row 40 and is ready to
        // insert more values. Both threads should wait until the other thread
        // has reached the barrier before continuing.
        final Barrier barrier = new Barrier(2);

        // Lock a row on the first page in a different thread to stop the
        // index scan. Then split the first leaf by inserting many values
        // less than zero.
        new AsyncThread(new AsyncTask() {
            public void doWork(Connection conn) throws Exception {
                conn.setAutoCommit(false);
                Statement s = conn.createStatement();
                s.executeUpdate("update t set x = x where x = 40");
                s.close();

                // Tell the main thread that we've locked the row and that
                // it can go ahead with the index scan. Wait here until the
                // main thread has started the scan.
                barrier.await();

                // The main thread has started the index scan. Give it a
                // second to get to the row we have locked.
                Thread.sleep(1000L);

                // Split the first leaf
                PreparedStatement ps = conn.prepareStatement(
                        "insert into t values ?");
                for (int i = -1; i > -300; i--) {
                    ps.setInt(1, i);
                    ps.executeUpdate();
                }
                ps.close();
                conn.commit();
            }
        });

        // Prepare the index scan.
        ResultSet rs = s.executeQuery(
                "select * from t --DERBY-PROPERTIES constraint=C");

        // Perform an index scan. Will be blocked for a while when fetching
        // the row where x=40, but should be able to resume the scan.
        for (int i = 0; i < 300; i++) {
            assertTrue(rs.next());
            assertEquals(i, rs.getInt(1));

            // Once we have fetched the first row, tell the helper thread we
            // have started the index scan, and wait until it has locked the
            // row that should block the scan (x=40).
            if (i == 0) {
                barrier.await();
            }
        }
        assertFalse(rs.next());
        rs.close();
    }
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.