Package com.surftools.BeanstalkClient

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


      assertEquals(jobIds[0], 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


    } catch (Exception e) {

    }

    // reserve and delete
    job = client.reserve(null);
    assertNotNull(job);
    assertEquals(jobId, job.getJobId());
    client.delete(job.getJobId());

    // peek one last time
View Full Code Here

    // peekBuried
    job = client.peekBuried();
    assertNull(job);

    // reserve and bury
    job = client.reserve(null);
    assertNotNull(job);
    assertEquals(jobId, job.getJobId());
    client.bury(job.getJobId(), 65536);

    // peekBuried
View Full Code Here

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

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

      // verify bytes
View Full Code Here

    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

    long putMillis = System.currentTimeMillis();
    long jobId = client.put(65536, timeoutSeconds, 120, srcString.getBytes());
    assertTrue(jobId > 0);

    // consumer
    Job job = client.reserve(timeoutSeconds);
    long getMillis = System.currentTimeMillis();

    assertNotNull(job);
    long newJobId = job.getJobId();
    assertEquals(jobId, newJobId);
View Full Code Here

    // now try to achieve a TIMED_OUT
    jobId = client.put(65536, 2 * timeoutSeconds, 120, srcString.getBytes());
    assertTrue(jobId > 0);

    job = client.reserve(timeoutSeconds);
    assertNull(job);

    popWatchedTubes(client, tubeNames);
  }

View Full Code Here

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

    Job job = client.reserve(null);
    assertNotNull(job);
    boolean ok = client.delete(job.getJobId());
    assertTrue(ok);

    // delete a second time
View Full Code Here

    // not found
    boolean ok = client.release(jobId, 65536, 0);
    assertFalse(ok);

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

    // quick release
    ok = client.release(jobId, 65536, 0);
View Full Code Here

    // quick release
    ok = client.release(jobId, 65536, 0);
    assertTrue(ok);

    job = client.reserve(null);
    assertNotNull(job);
    assertEquals(jobId, job.getJobId());

    ok = client.delete(jobId);
    assertTrue(ok);
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.