Examples of Counter


Examples of com.proofpoint.stats.SparseCounterStat.Counter

    private void assertPreviousCount(SparseCounterStat counter, double expected)
            throws Exception
    {
        Method method = Bucketed.class.getDeclaredMethod("getPreviousBucket");
        method.setAccessible(true);
        Counter previousBucket = (Counter) method.invoke(counter);
        assertEquals(previousBucket.getCount(), expected);
    }
View Full Code Here

Examples of com.sk89q.worldedit.function.block.Counter

     * @param searchBlocks the list of blocks to search
     * @return the number of blocks that matched the pattern
     */
    public int countBlocks(Region region, Set<BaseBlock> searchBlocks) {
        FuzzyBlockMask mask = new FuzzyBlockMask(this, searchBlocks);
        Counter count = new Counter();
        RegionMaskingFilter filter = new RegionMaskingFilter(mask, count);
        RegionVisitor visitor = new RegionVisitor(region, filter);
        Operations.completeBlindly(visitor); // We can't throw exceptions, nor do we expect any
        return count.getCount();
    }
View Full Code Here

Examples of com.sleepycat.je.dbi.StartupTracker.Counter

    private void findEndOfLog(boolean readOnly)
        throws IOException, DatabaseException {

        startupTracker.start(Phase.FIND_END_OF_LOG);
        startupTracker.setProgress(RecoveryProgress.FIND_END_OF_LOG);
        Counter counter = startupTracker.getCounter(Phase.FIND_END_OF_LOG);
        LastFileReader reader = new LastFileReader(envImpl, readBufferSize);

        /*
         * Tell the reader to iterate through the log file until we hit the end
         * of the log or an invalid entry.  Remember the last seen CkptEnd, and
         * the first CkptStart with no following CkptEnd.
         */
        while (reader.readNextEntry()) {
            counter.incNumRead();
            counter.incNumProcessed();
            LogEntryType type = reader.getEntryType();
            if (LogEntryType.LOG_CKPT_END.equals(type)) {
                info.checkpointEndLsn = reader.getLastLsn();
                info.partialCheckpointStartLsn = DbLsn.NULL_LSN;
            } else if (LogEntryType.LOG_CKPT_START.equals(type)) {
                if (info.partialCheckpointStartLsn == DbLsn.NULL_LSN) {
                    info.partialCheckpointStartLsn = reader.getLastLsn();
                }
            } else if (LogEntryType.LOG_DBTREE.equals(type)) {
                info.useRootLsn = reader.getLastLsn();
            }
        }

        /*
         * The last valid LSN should point to the start of the last valid log
         * entry, while the end of the log should point to the first byte of
         * blank space, so these two should not be the same.
         */
        assert (reader.getLastValidLsn() != reader.getEndOfLog()):
        "lastUsed=" + DbLsn.getNoFormatString(reader.getLastValidLsn()) +
            " end=" + DbLsn.getNoFormatString(reader.getEndOfLog());

        /* Now truncate if necessary. */
        if (!readOnly) {
            reader.setEndOfFile();
        }

        /* Tell the fileManager where the end of the log is. */
        info.lastUsedLsn = reader.getLastValidLsn();
        info.nextAvailableLsn = reader.getEndOfLog();
        counter.setRepeatIteratorReads(reader.getNRepeatIteratorReads());
        envImpl.getFileManager().setLastPosition(info.nextAvailableLsn,
                                                 info.lastUsedLsn,
                                                 reader.getPrevOffset());
        startupTracker.stop(Phase.FIND_END_OF_LOG);
    }
View Full Code Here

Examples of com.subhajit.common.jmx.util.Counter

        // MethodBean methodBean = new MethodBean(method);
        // methodBeans.put(method, methodBean);
        String methodStr = toString(method);
        cpuMeterMap.put(methodStr, new CpuMeter());
        executionTimers.put(methodStr, new Timer());
        executionCounters.put(methodStr, new Counter());
      }
    }
    lock = new ReentrantLock();
  }
View Full Code Here

Examples of com.sun.bookstore1.util.Counter

        }

        StringWriter sw = new StringWriter();
        PrintWriter writer = new PrintWriter(sw);

        Counter counter = (Counter) filterConfig.getServletContext()
                                                .getAttribute("hitCounter");
        writer.println();
        writer.println(
                "=======================================================");
        writer.println("The number of hits is: " + counter.incCounter());
        writer.println(
                "=======================================================");

        // Log the resulting string
        writer.flush();
        System.out.println(sw.getBuffer().toString());

        PrintWriter out = response.getWriter();
        CharResponseWrapper wrapper = new CharResponseWrapper(
                    (HttpServletResponse) response);
        chain.doFilter(request, wrapper);

        CharArrayWriter caw = new CharArrayWriter();
        caw.write(
                wrapper.toString().substring(
                        0,
                        wrapper.toString().indexOf("</body>") - 1));
        caw.write(
                "<p>\n<center>" + messages.getString("Visitor")
                + "<font color='red'>" + counter.getCounter()
                + "</font></center>");
        caw.write("\n</body></html>");
        response.setContentLength(caw.toString()
                                     .getBytes().length);
        out.write(caw.toString());
View Full Code Here

Examples of com.sun.sgs.test.impl.service.task.TestTaskServiceImpl.Counter

        private static final long serialVersionUID = 1;
        public void run() throws Exception {
            TestMultiNodeTaskServiceImpl.lastNodeUsed.
                set(AppContext.getManager(NodeIdManager.class).getNodeId());
            DataManager dataManager = AppContext.getDataManager();
            Counter counter = (Counter) dataManager.getBinding("counter");
            dataManager.markForUpdate(counter);
            counter.decrement();
        }
View Full Code Here

Examples of com.tek42.perforce.model.Counter

                }
            }
            depot.setExecutable(exe);

            try {
                Counter counter = depot.getCounters().getCounter("change");
                if (counter != null)
                    return depot;
            } catch (PerforceException e) {
            }
View Full Code Here

Examples of com.voyagegames.core.modules.Counter

public class CounterTest {

  @Test
  public void value_initializedAtZero() {
    Counter c = new Counter();
    assertTrue(c.value() == 0);
  }
View Full Code Here

Examples of com.yammer.metrics.core.Counter

  }

  @Override
  public void sendWritableRequest(Integer destTaskId,
                                  WritableRequest request) {
    Counter counter = superstepRequestCounters.get(request.getType());
    if (counter != null) {
      counter.inc();
    }
    nettyClient.sendWritableRequest(destTaskId, request);
  }
View Full Code Here

Examples of game.core.Counter

     * Initialise l'animation et le counter
     * @param guiModel
     */
    public TitleModel(final GUIModel guiModel) {
        Event.setTitleEvent(new TitleEvent(this));
        counter = new Counter();
        audioPlayer = new AudioPlayer(GeneralConstant.MUSIQUE_PATH + "title.mp3");
        audioPlayer.start();
        Collector.signaler(audioPlayer);
        animation = new TitleAnimation();
        Collector.signaler(animation);
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.