Package com.surftools.BeanstalkClient

Examples of com.surftools.BeanstalkClient.Client.reserve()


        client.useTube((String) tubeNames[1]);
        long jobId = client.put(65536, 0, 120, srcString.getBytes());
        assertTrue(jobId > 0);

        // consumer
        Job job = client.reserve(null);
        assertNotNull(job);
        long newJobId = job.getJobId();
        assertEquals(jobId, newJobId);

        String dstString = new String(job.getData());
View Full Code Here


    Job job = client.peekReady();
    assertNotNull(job);
    assertEquals(jobId, job.getJobId());

    // reserve with timeout a little less than tube pause time
    job = client.reserve(tubeDelay - 1);
    assertNull(job);

    // now wait for tube to become un-paused
    job = client.reserve(2);
    assertNotNull(job);
View Full Code Here

    // reserve with timeout a little less than tube pause time
    job = client.reserve(tubeDelay - 1);
    assertNull(job);

    // now wait for tube to become un-paused
    job = client.reserve(2);
    assertNotNull(job);
    assertEquals(jobId, job.getJobId());

    popWatchedTubes(client, tubeNames);
  }
View Full Code Here

    // we haven't reserved, so we can't bury
    ok = client.bury(jobId, 65536);
    assertFalse(ok);

    // we can bury
    Job job = client.reserve(0);
    assertNotNull(job);
    ok = client.bury(jobId, 65536);
    assertTrue(ok);

    // nothing to reserve
View Full Code Here

    assertNotNull(job);
    ok = client.bury(jobId, 65536);
    assertTrue(ok);

    // nothing to reserve
    job = client.reserve(0);
    assertNull(job);

    // kick non-existent job
    ok = client.kickJob(Integer.MAX_VALUE);
    assertFalse(ok);
View Full Code Here

    // we haven't reserved, so we can't touch
    ok = client.touch(jobId);
    assertFalse(ok);

    // reserve the job
    Job job = client.reserve(null);
    assertNotNull(job);

    // try to reserve another job
    try {
      job = client.reserve(2 * timeoutSeconds);
 
View Full Code Here

    Job job = client.reserve(null);
    assertNotNull(job);

    // try to reserve another job
    try {
      job = client.reserve(2 * timeoutSeconds);
      fail("expected DEADLINE_SOON");
    } catch (BeanstalkException be) {
      String message = be.getMessage();
      assertEquals("DEADLINE_SOON", message);
      ok = client.touch(jobId);
View Full Code Here

    // producer
    client.useTube((String) tubeNames[1]);
    long jobId = client.put(65536, 0, 120, srcString.getBytes());
    assertTrue(jobId > 0);

    Job job = client.reserve(null);
    assertNotNull(job);
    client.delete(jobId);

    map = client.statsTube((String) tubeNames[1]);
    assertNotNull(map);
View Full Code Here

    // producer
    client.useTube((String) tubeNames[1]);
    long jobId = client.put(65536, 0, 120, srcString.getBytes());
    assertTrue(jobId > 0);

    Job job = client.reserve(null);
    assertNotNull(job);

    map = client.statsJob(jobId);
    assertNotNull(map);
View Full Code Here

      assertEquals(jobIds[i], job.getJobId());
    }

    // reserve and delete
    for (int i = 0; i < nJobs; ++i) {
      job = client.reserve(null);
      assertNotNull(job);
      assertEquals(jobIds[i], job.getJobId());
      client.delete(job.getJobId());
    }
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.