Examples of Timed


Examples of org.apache.jackrabbit.oak.jcr.session.RefreshStrategy.Timed

                new Once(false),
                new LogOnce(60),
                new ThreadSynchronising(threadSaveCount)}
                : new RefreshStrategy[] {
                new Once(false),
                new Timed(refreshInterval),
                new ThreadSynchronising(threadSaveCount)});
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.jcr.session.RefreshStrategy.Timed

                new Once(false),
                new LogOnce(60),
                new ThreadSynchronising(threadSaveCount)}
                : new RefreshStrategy[] {
                new Once(false),
                new Timed(refreshInterval),
                new LogOnce(60),
                new ThreadSynchronising(threadSaveCount)});
    }
View Full Code Here

Examples of org.jboss.errai.ioc.client.api.Timed

  @Override
  public List<? extends Statement> generateDecorator(InjectableInstance<Timed> ctx) {
    try {
      final MetaClass beanClass = ctx.getEnclosingType();
      final Timed timed = ctx.getAnnotation();


      final Statement methodInvokation
          = InjectUtil.invokePublicOrPrivateMethod(ctx.getInjectionContext(), Refs.get("beanInstance"),
          ctx.getMethod());

      final org.jboss.errai.common.client.util.TimeUnit timeUnit = timed.timeUnit();
      final int interval = timed.interval();

      final Statement timerDecl
          = Stmt.nestedCall(Stmt.newObject(Timer.class).extend()
          .publicOverridesMethod("run")
          .append(methodInvokation)
          .finish().finish());

      final String timerVarName = InjectUtil.getUniqueVarName();
      final Statement timerVar = Stmt.declareFinalVariable(timerVarName, Timer.class, timerDecl);

      final List<Statement> statements = new ArrayList<Statement>();
      //  statements.add(timerVar);

      final Statement timerExec;
      switch (timed.type()) {
        case REPEATING:
          timerExec = Stmt.loadVariable(timerVarName).invoke("scheduleRepeating", timeUnit.toMillis(interval));
          break;
        default:
        case DELAYED:
View Full Code Here

Examples of org.springframework.test.annotation.Timed

   * {@link FrameworkMethod test method}.
   *
   * @return the timeout, or <code>0</code> if none was specified.
   */
  protected long getSpringTimeout(FrameworkMethod frameworkMethod) {
    Timed timedAnnotation = frameworkMethod.getAnnotation(Timed.class);
    return (timedAnnotation != null && timedAnnotation.millis() > 0 ? timedAnnotation.millis() : 0);
  }
View Full Code Here

Examples of org.springframework.test.annotation.Timed

   * @throws Throwable if any exception is thrown
   * @see Timed
   * @see #runTest
   */
  private void runTestTimed(TestExecutionCallback tec, Method testMethod) throws Throwable {
    Timed timed = testMethod.getAnnotation(Timed.class);
    if (timed == null) {
      runTest(tec, testMethod);
    }
    else {
      long startTime = System.currentTimeMillis();
      try {
        runTest(tec, testMethod);
      }
      finally {
        long elapsed = System.currentTimeMillis() - startTime;
        if (elapsed > timed.millis()) {
          fail("Took " + elapsed + " ms; limit was " + timed.millis());
        }
      }
    }
  }
View Full Code Here

Examples of org.springframework.test.annotation.Timed

   * {@link Timed &#064;Timed} annotation on the supplied
   * {@link FrameworkMethod test method}.
   * @return the timeout, or <code>0</code> if none was specified.
   */
  protected long getSpringTimeout(FrameworkMethod frameworkMethod) {
    Timed timedAnnotation = frameworkMethod.getAnnotation(Timed.class);
    return (timedAnnotation != null && timedAnnotation.millis() > 0 ? timedAnnotation.millis() : 0);
  }
View Full Code Here

Examples of org.springframework.test.annotation.Timed

   * @throws Throwable if any exception is thrown
   * @see Timed
   * @see #runTest
   */
  private void runTestTimed(TestExecutionCallback tec, Method testMethod) throws Throwable {
    Timed timed = testMethod.getAnnotation(Timed.class);
    if (timed == null) {
      runTest(tec, testMethod);
    }
    else {
      long startTime = System.currentTimeMillis();
      try {
        runTest(tec, testMethod);
      }
      finally {
        long elapsed = System.currentTimeMillis() - startTime;
        if (elapsed > timed.millis()) {
          fail("Took " + elapsed + " ms; limit was " + timed.millis());
        }
      }
    }
  }
View Full Code Here

Examples of org.springframework.test.annotation.Timed

      return;
    }

    this.notifier.fireTestStarted(this.description);
    try {
      Timed timedAnnotation = this.testMethod.getMethod().getAnnotation(Timed.class);
      long springTimeout = (timedAnnotation != null && timedAnnotation.millis() > 0 ?
          timedAnnotation.millis() : 0);
      long junitTimeout = this.testMethod.getTimeout();
      if (springTimeout > 0 && junitTimeout > 0) {
        throw new IllegalStateException("Test method [" + this.testMethod.getMethod() +
            "] has been configured with Spring's @Timed(millis=" + springTimeout +
            ") and JUnit's @Test(timeout=" + junitTimeout +
View Full Code Here

Examples of org.springframework.test.annotation.Timed

   * @throws Throwable if any exception is thrown
   * @see Timed
   * @see #runTest
   */
  private void runTestTimed(TestExecutionCallback tec, Method testMethod) throws Throwable {
    Timed timed = testMethod.getAnnotation(Timed.class);
    if (timed == null) {
      runTest(tec, testMethod);
    }
    else {
      long startTime = System.currentTimeMillis();
      try {
        runTest(tec, testMethod);
      }
      finally {
        long elapsed = System.currentTimeMillis() - startTime;
        if (elapsed > timed.millis()) {
          fail("Took " + elapsed + " ms; limit was " + timed.millis());
        }
      }
    }
  }
View Full Code Here

Examples of org.waveprotocol.box.stat.Timed

      });

  @Override
  public Object invoke(MethodInvocation methodInvocation) throws Throwable {
    Method method = methodInvocation.getMethod();
    Timed timed = method.getAnnotation(Timed.class);
    String name = timed.value();
    if (name.isEmpty()) {
      name = nameCache.get(methodInvocation.getMethod());
    }
    Timer timer;
    if (timed.isRequest()) {
      timer = Timing.startRequest(name, timed.threshold());
    } else {
      timer = Timing.start(name, timed.threshold());
    }
    try {
      return methodInvocation.proceed();
    } finally {
      Timing.stop(timer);
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.