Examples of Counter


Examples of org.eclipse.sapphire.Counter

    @Test
   
    public void testReadUnderlyingListCount()
    {
        final TestResource resource = new TestResource();
        final Counter counter = resource.getReadUnderlyingListCounter();
        final TestElement element = TestElement.TYPE.instantiate( resource );
        final ElementList<Element> list = element.getList();
       
        list.iterator(); // prime
        counter.reset();
       
        list.refresh();
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.insert();
        assertEquals( 1, counter.read() );
        counter.reset();

        list.remove( 0 );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        final Element a = list.insert();
        final Element b = list.insert();
        assertEquals( 2, counter.read() );
        counter.reset();
       
        list.moveDown( a );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.moveUp( a );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.move( b, 0 );
        assertEquals( 1, counter.read() );
        counter.reset();
    }
View Full Code Here

Examples of org.jayasoft.woj.portal.model.Counter

    /* (non-Javadoc)
     * @see org.jayasoft.woj.portal.data.dao.hibernate.DefaultHibernateWOJDao#newHandledObject()
     */
    public WOJObject newHandledObject() {
        return new Counter();
    }
View Full Code Here

Examples of org.jboss.resteasy.cdi.util.Counter

      try
      {
         log.info(this + ": msg: " + tm.getText());
         BookCollection collection = resource.getBookCollection();
         log.info(this + ": collection.size() before: " + collection.getBooks().size());
         Counter counter = resource.getCounter();
         collection.addBook(new Book(counter.getNext(), tm.getText()));
         log.info(this + ": collection.size() after: " + collection.getBooks().size());
         CountDownLatch latch = resource.getCountDownLatch();
         latch.countDown(); // Tell BookResource book has been stored.
      }
      catch (JMSException e)
View Full Code Here

Examples of org.jboss.soa.esb.actions.Counter

        objectList = new ObjectMapper().createObjectList(message, messagePathList);
    ruleInfo = new RuleInfoBuilder("JBossESBPricingRulesStateful.drl").reload(true).globals(globals).defaultFacts(objectList).build();
    statefulRuleInfo = new StatefulRuleInfoImpl(ruleInfo, false, true);
    message = ruleService.continueStatefulRulesExecution( statefulRuleInfo, message );

        Counter counter = (Counter) message.getBody().get("Counter");
        assertEquals( 2 , counter.getCounter() );
  }
View Full Code Here

Examples of org.jboss.test.ejb3.war.deployment.Counter

    * @throws Exception
    */
   public void testEjbDeploymentInWar() throws Exception
   {
      Context ctx = new InitialContext();
      Counter counter = (Counter) ctx.lookup("CounterDelegateBean/remote");

      int count = counter.increment();
      assertEquals("Unexpected count after increment", 1, count);

      // increment one more time
      count = counter.increment();
      assertEquals("Unexpected count after second increment", 2, count);

      // now decrement
      count = counter.decrement();
      assertEquals("Unexpected count after decrement", 1, count);

      // decrement one more time
      count = counter.decrement();
      assertEquals("Unexpected count after second decrement", 0, count);

   }
View Full Code Here

Examples of org.jgroups.blocks.atomic.Counter


    void loop() throws Exception {
        CounterService counter_service=new CounterService(ch);
        ch.connect("counter-cluster");
        Counter counter=counter_service.getOrCreateCounter("mycounter", 1);

        boolean looping=true;
        while(looping) {
            try {
                int key=Util.keyPress("[1] Increment [2] Decrement [3] Compare and set\n" +
                                        "[4] Create counter [5] Delete counter\n" +
                                        "[6] Print counters [7] Get counter\n" +
                                        "[8] Increment 1M times [9] Dump pending requests [x] Exit\n");
                switch(key) {
                    case '1':
                        long val=counter.incrementAndGet();
                        System.out.println("counter: " + val);
                        break;
                    case '2':
                        val=counter.decrementAndGet();
                        System.out.println("counter: " + val);
                        break;
                    case '3':
                        long expect=Util.readLongFromStdin("expected value: ");
                        long update=Util.readLongFromStdin("update: ");
                        if(counter.compareAndSet(expect, update)) {
                            System.out.println("-- set counter \"" + counter.getName() + "\" to " + update + "\n");
                        }
                        else {
                            System.err.println("failed setting counter \"" + counter.getName() + "\" from " + expect +
                                                 " to " + update + ", current value is " + counter.get() + "\n");
                        }
                        break;
                    case '4':
                        String counter_name=Util.readStringFromStdin("counter name: ");
                        counter=counter_service.getOrCreateCounter(counter_name, 1);
                        break;
                    case '5':
                        counter_name=Util.readStringFromStdin("counter name: ");
                        counter_service.deleteCounter(counter_name);
                        break;
                    case '6':
                        System.out.println("Counters (current=" + counter.getName() + "):\n\n" + counter_service.printCounters());
                        break;
                    case '7':
                        counter.get();
                        break;
                    case '8':
                        int NUM=Util.readIntFromStdin("num: ");
                        System.out.println("");
                        int print=NUM / 10;
                        long retval=0;
                        long start=System.currentTimeMillis();
                        for(int i=0; i < NUM; i++) {
                            retval=counter.incrementAndGet();
                            if(i > 0 && i % print == 0)
                                System.out.println("-- count=" + retval);
                        }
                        long diff=System.currentTimeMillis() - start;
                        System.out.println("\n" + NUM + " incrs took " + diff + " ms; " + (NUM / (diff / 1000.0)) + " ops /sec\n");
View Full Code Here

Examples of org.jgroups.protocols.COUNTER

      .build();
    this.manager = new DefaultCacheManager(gcb.build(), c);

    if(!local){
      JGroupsTransport transport = (JGroupsTransport) manager.getCache("first").getAdvancedCache().getRpcManager().getTransport();
      this.cacheChannel = new ForkChannel(transport.getChannel(), "drill-stack", "drill-hijacker", true, ProtocolStack.ABOVE, FRAG2.class, new COUNTER());
      this.counters = new CounterService(this.cacheChannel);
    }else{
      this.cacheChannel = null;
      this.counters = null;
    }
View Full Code Here

Examples of org.jnode.vm.objects.Counter

        log.debug(flags.getName() + " : Init disable");
        // reset
        regs.setReg32(SCBPort, 0);
        // disable
        regs.setReg32(SCBPort, 2);
        Counter count = new Counter("chrono");
        while ((Integer) count.getValue() <= 20)
            count.inc();
        regs.setReg16(SCBCmd, SCBMaskAll);
        int intr_status = regs.getReg16(SCBStatus);
        regs.setReg16(SCBStatus, intr_status);
        regs.getReg16(SCBStatus);
View Full Code Here

Examples of org.jruby.ir.Counter

        Object exception = null;
        Ruby runtime = context.runtime;
        DynamicScope currDynScope = context.getCurrentScope();

        // Set up thread-poll counter for this scope
        Counter tpCount = null;
        if (profile) {
            tpCount = scopeThreadPollCounts.get(scope);
            if (tpCount == null) {
                tpCount = new Counter();
                scopeThreadPollCounts.put(scope, tpCount);
            }
        }

        // Enter the looooop!
View Full Code Here

Examples of org.mule.util.counters.Counter

        return (Counter) counters.get(name);
    }

    public static Counter createCounter(String name, String first, String second, Type type, boolean visible)
    {
        Counter counter = getCounter(name);
        if (counter != null)
        {
            throw new IllegalStateException();
        }
        else
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.