Examples of Timer


Examples of com.lissenberg.blog.util.Timer

public class SecurityServiceTest extends TestCase {
    @Test
    public void testCreateHash() throws Exception {
        SecurityService securityService = new SecurityService();
        Timer timer = new Timer();
        String hash1 = securityService.createHash("My secret password!");
        System.out.println("Hashing took: " + timer.getDuration() + " millis");
        String hash2 = securityService.createHash("My secret password!");
        String hash3 = securityService.createHash("my secret password!");
        assertEquals(hash1, hash2);
        assertNotSame(hash1, hash3);
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.java.util.Timer

    public ReflectionModelLoader(ModuleManager moduleManager, Modules modules, Logger log){
        this.moduleManager = moduleManager;
        this.modules = modules;
        this.typeFactory = new Unit();
        this.typeParser = new TypeParser(this);
        this.timer = new Timer(false);
        this.log = log;
    }
View Full Code Here

Examples of com.softwarementors.extjs.djn.Timer

  /* package */ String processIndividualRequest( JsonRequestData request, boolean isBatched, int requestNumber ) {
    assert request != null;
    boolean resultReported = false;

    Timer timer = new Timer();
    try {
      if( isBatched ) {
        if( logger.isDebugEnabled() ) {
          logger.debug( "  - Individual request #" + requestNumber + " request data=>" + getGson().toJson(request) );
        }
      }
      Object[] parameters = getIndividualRequestParameters( request);
      String action = request.getAction();
      String method = request.getMethod();
      StandardSuccessResponseData response = new StandardSuccessResponseData( request.getTid(), action, method);

      JsonDeserializationManager mgr = JsonDeserializationManager.getManager();
      try {

        Object result = dispatchStandardMethod(action, method, parameters);
        mgr.friendOnlyAccess_setRoot(result);
        response.setResult(result);
        String json = getGson().toJson(response);
        if( isBatched ) {
          if( logger.isDebugEnabled() ) {
            timer.stop();
            timer.logDebugTimeInMilliseconds( "  - Individual request #" + requestNumber + " response data=>" + json );
            resultReported = true;
          }
        }
        return json;
      }
      finally {
        mgr.friendOnlyAccess_dispose(); // Cleanup in case we are reusing thread
      }
    }
    catch( Exception t ) {       
      StandardErrorResponseData response = createJsonServerErrorResponse(request, t);
      String json = getGson().toJson(response);
      logger.error( "(Controlled) server error: " + t.getMessage() + " for Method '" + request.getFullMethodName() + "'", t);
      return json;
    }
    finally {
      if( !resultReported ) {
        timer.stop();
        // No point in logging individual requests when the request is not batched
        if( isBatched ) {
          if( logger.isDebugEnabled() ) {
            timer.logDebugTimeInMilliseconds( "  - Individual request #" + requestNumber + ": " + request.getFullMethodName() + ". Time");
          }
        }
      }
    }
  }
View Full Code Here

Examples of com.sogou.qadev.service.cynthia.bean.Timer

   * @param timerId
   * @return
   */
  public Timer queryTimer(UUID timerId)
  {
    Timer timer = null;

    Connection conn = null;
    PreparedStatement pstm = null;
    ResultSet rst = null;
    try
    {
      conn = DbPoolConnection.getInstance().getReadConnection();
      pstm = conn.prepareStatement("SELECT * FROM timer"
          + " WHERE id = ?");
      pstm.setLong(1, Long.parseLong(timerId.getValue()));

      rst = pstm.executeQuery();
      if(rst.next())
      {
        String createUser = rst.getString("create_user");
        Timestamp createTime = rst.getTimestamp("create_time");

        timer = new TimerImpl(timerId, createUser, createTime);
        timer.setName(rst.getString("name"));
        timer.setActionId(DataAccessFactory.getInstance().createUUID(rst.getObject("action_id").toString()));
        timer.setActionParam(rst.getString("action_param"));
        timer.setYear(rst.getString("year"));
        timer.setMonth(rst.getString("month"));
        timer.setWeek(rst.getString("week"));
        timer.setDay(rst.getString("day"));
        timer.setHour(rst.getString("hour"));
        timer.setMinute(rst.getString("minute"));
        timer.setSecond(rst.getString("second"));

        Object filterIdObj = rst.getObject("filter_id");
        if(filterIdObj != null)
          timer.setFilterId(DataAccessFactory.getInstance().createUUID(filterIdObj.toString()));

        Object statisticerIdObj = rst.getObject("statisticer_id");
        if(statisticerIdObj != null)
          timer.setStatisticerId(DataAccessFactory.getInstance().createUUID(statisticerIdObj.toString()));

        timer.setStart(rst.getBoolean("is_start"));
        timer.setRetryAccount(rst.getLong("retry_account"));
        timer.setRetryDelay(rst.getLong("retry_delay"));
        timer.setSendNull(rst.getBoolean("is_send_null"));
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
View Full Code Here

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

      for (Method method : klass.getMethods()) {
        // 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.faban.driver.util.Timer

        logger.info("Output directory for this run is : " + runOutputDir);
        runInfo.resultsDir = runOutputDir;

        configureLogger (runOutputDir);

        timer = new Timer();

        agentRefs = new Agent[benchDef.drivers.length][];
        agentThreads = new int[benchDef.drivers.length];
        remainderThreads = new int[benchDef.drivers.length];
View Full Code Here

Examples of com.sun.faces.util.Timer

         * @throws Exception if an error occurs during the parsing process
         */
        public Document call() throws Exception {

            try {
                Timer timer = Timer.getInstance();
                if (timer != null) {
                    timer.startTiming();
                }

                Document d = getDocument();

                if (timer != null) {
                    timer.stopTiming();
                    timer.logResult("Parse " + documentURL.toExternalForm());
                }
             
                return d;
            } catch (Exception e) {
                throw new ConfigurationException(MessageFormat.format(
View Full Code Here

Examples of com.vladmihalcea.flexypool.metric.Timer

    @Test
    public void testTimer() {
        CodahaleMetrics codahaleMetrics = new CodahaleMetrics(configurationProperties, reservoirFactory);
        when(reservoirFactory.newInstance(com.codahale.metrics.Timer.class, "timer")).thenReturn(reservoir);
        Timer timer = codahaleMetrics.timer("timer");
        verify(reservoirFactory, times(1)).newInstance(com.codahale.metrics.Timer.class, "timer");
        assertNotNull(timer);
    }
View Full Code Here

Examples of com.yammer.metrics.core.Timer

  public InputBenchmark() { }

  public void run(InputBenchmarkCmd args) throws Exception {
    HadoopNative.requireHadoopNative();

    Timer allTime = Metrics.newTimer(InputBenchmark.class, "all-time", MILLISECONDS, MILLISECONDS);
    TimerContext allTimerContext = allTime.time();

    HiveInputDescription input = new HiveInputDescription();
    input.setDbName(args.tableOpts.database);
    input.setTableName(args.tableOpts.table);
    input.setPartitionFilter(args.tableOpts.partitionFilter);
View Full Code Here

Examples of commonj.timers.Timer

                          Date          firstTime,
                          long          period )
   {
      java.util.Timer timer = (java.util.Timer) timerPool.get( this.currentTimer );
      this.currentTimer = ( this.currentTimer + 1 ) % this.poolSize;
      Timer                newTimer = new TimerImpl( listener, period );
      TimerTaskImpl task = new TimerTaskImpl( newTimer, this );
      this.taskList.add( task );
      timer.schedule( task, firstTime, period );
      return newTimer;
   }
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.