Examples of mayExecute()


Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

      throws Exception
  {
    final ConstrainedExecutor ci = new ConstrainedExecutorImpl(Executors.newFixedThreadPool(2));

    final TestWorker tw = new TestWorker("1", 5);
    ci.mayExecute("foo", tw);
    tw.waitForExecuted();
    assertThat(tw.isJobDone(), equalTo(true));
    assertThat(tw.isExecuting(), equalTo(false));
    assertThat(tw.isCanceled(), equalTo(false));
    assertThat(ci.getStatistics().getCurrentlyRunningJobKeys(), is(empty()));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw1 = new TestWorker("1", 100);
    final TestWorker tw2 = new TestWorker("2", 10);
    final TestWorker tw3 = new TestWorker("3", 10);
    final TestWorker tw4 = new TestWorker("4", 10);
    final TestWorker tw5 = new TestWorker("5", 10);
    assertThat(ci.mayExecute("foo", tw1), is(true));
    assertThat(ci.mayExecute("foo", tw2), is(false));
    assertThat(ci.mayExecute("foo", tw3), is(false));
    assertThat(ci.mayExecute("foo", tw4), is(false));
    assertThat(ci.mayExecute("foo", tw5), is(false));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw2 = new TestWorker("2", 10);
    final TestWorker tw3 = new TestWorker("3", 10);
    final TestWorker tw4 = new TestWorker("4", 10);
    final TestWorker tw5 = new TestWorker("5", 10);
    assertThat(ci.mayExecute("foo", tw1), is(true));
    assertThat(ci.mayExecute("foo", tw2), is(false));
    assertThat(ci.mayExecute("foo", tw3), is(false));
    assertThat(ci.mayExecute("foo", tw4), is(false));
    assertThat(ci.mayExecute("foo", tw5), is(false));

    tw1.waitForExecuted();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw3 = new TestWorker("3", 10);
    final TestWorker tw4 = new TestWorker("4", 10);
    final TestWorker tw5 = new TestWorker("5", 10);
    assertThat(ci.mayExecute("foo", tw1), is(true));
    assertThat(ci.mayExecute("foo", tw2), is(false));
    assertThat(ci.mayExecute("foo", tw3), is(false));
    assertThat(ci.mayExecute("foo", tw4), is(false));
    assertThat(ci.mayExecute("foo", tw5), is(false));

    tw1.waitForExecuted();
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw4 = new TestWorker("4", 10);
    final TestWorker tw5 = new TestWorker("5", 10);
    assertThat(ci.mayExecute("foo", tw1), is(true));
    assertThat(ci.mayExecute("foo", tw2), is(false));
    assertThat(ci.mayExecute("foo", tw3), is(false));
    assertThat(ci.mayExecute("foo", tw4), is(false));
    assertThat(ci.mayExecute("foo", tw5), is(false));

    tw1.waitForExecuted();

    // did the job
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw5 = new TestWorker("5", 10);
    assertThat(ci.mayExecute("foo", tw1), is(true));
    assertThat(ci.mayExecute("foo", tw2), is(false));
    assertThat(ci.mayExecute("foo", tw3), is(false));
    assertThat(ci.mayExecute("foo", tw4), is(false));
    assertThat(ci.mayExecute("foo", tw5), is(false));

    tw1.waitForExecuted();

    // did the job
    assertThat(tw1.isJobDone(), equalTo(true));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw2 = new TestWorker("2", 50000);
    final TestWorker tw3 = new TestWorker("3", 50000);
    final TestWorker tw4 = new TestWorker("4", 50000);
    final TestWorker tw5 = new TestWorker("5", 50000);

    assertThat(ci.mayExecute("foo1", tw1), equalTo(true));
    assertThat(ci.mayExecute("foo2", tw2), equalTo(true));
    assertThat(ci.mayExecute("foo3", tw3), equalTo(true));
    assertThat(ci.mayExecute("foo4", tw4), equalTo(true));
    assertThat(ci.mayExecute("foo5", tw5), equalTo(true));
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw3 = new TestWorker("3", 50000);
    final TestWorker tw4 = new TestWorker("4", 50000);
    final TestWorker tw5 = new TestWorker("5", 50000);

    assertThat(ci.mayExecute("foo1", tw1), equalTo(true));
    assertThat(ci.mayExecute("foo2", tw2), equalTo(true));
    assertThat(ci.mayExecute("foo3", tw3), equalTo(true));
    assertThat(ci.mayExecute("foo4", tw4), equalTo(true));
    assertThat(ci.mayExecute("foo5", tw5), equalTo(true));

    // give time to executor to start them
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw4 = new TestWorker("4", 50000);
    final TestWorker tw5 = new TestWorker("5", 50000);

    assertThat(ci.mayExecute("foo1", tw1), equalTo(true));
    assertThat(ci.mayExecute("foo2", tw2), equalTo(true));
    assertThat(ci.mayExecute("foo3", tw3), equalTo(true));
    assertThat(ci.mayExecute("foo4", tw4), equalTo(true));
    assertThat(ci.mayExecute("foo5", tw5), equalTo(true));

    // give time to executor to start them
    Thread.sleep(1000);
View Full Code Here

Examples of org.sonatype.nexus.proxy.maven.routing.internal.task.executor.ConstrainedExecutor.mayExecute()

    final TestWorker tw5 = new TestWorker("5", 50000);

    assertThat(ci.mayExecute("foo1", tw1), equalTo(true));
    assertThat(ci.mayExecute("foo2", tw2), equalTo(true));
    assertThat(ci.mayExecute("foo3", tw3), equalTo(true));
    assertThat(ci.mayExecute("foo4", tw4), equalTo(true));
    assertThat(ci.mayExecute("foo5", tw5), equalTo(true));

    // give time to executor to start them
    Thread.sleep(1000);
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.