rtykulsker / javabeanstalkclient Goto Github PK
View Code? Open in Web Editor NEWa Java client for the beanstalkd workqueue service
License: GNU General Public License v3.0
a Java client for the beanstalkd workqueue service
License: GNU General Public License v3.0
Job job = client.reserve(3600);
returns immediately with a null job when the watched tubes are empty. Is this expected?
using the 1.0.4 code in Downloads.
I can't reopen "Exception on ignore" (https://github.com/RTykulsker/JavaBeanstalkClient/issues/closed#issue/5) but it's not yet fixed.
package cohadar.beantest;
import java.util.Random;
import org.testng.annotations.Test;
import com.surftools.BeanstalkClient.Client;
import com.surftools.BeanstalkClient.Job;
import com.surftools.BeanstalkClientImpl.ClientImpl;
public class TestBeanstalkd {
/**
* For some reason protocol cannot handle random binary data.
* Throws com.surftools.BeanstalkClient.BeanstalkException: �L�bbs�4Y�N�Sk|� (garbage)
* */
@Test
public void deathByRandom() throws Exception {
Client client = new ClientImpl();
for (int i = 0; i < 100; i++) {
byte[] jobData = new byte[20000];
new Random().nextBytes(jobData); // <------<< comment this line and it works fine
long jid = client.put(0, 0, 0, jobData);
System.out.println("Inserted:" + jid);
Job job = client.reserve(-1); // blocking wait
jid = job.getJobId();
System.out.println("Deleting:" + jid);
client.delete(jid);
}
}
}
I get
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:443)
at java.lang.Integer.parseInt(Integer.java:514)
at com.surftools.BeanstalkClientImpl.ClientImpl.ignore(ClientImpl.java:202)
when I .ignore("default");
Line 202 is in ignore()
return Integer.parseInt(response.getReponse());
Apparently the response can be null.
I'm using beanstalk client 1.2.2 patched for the Linux performance problem, and beanstalk 1.4.3-1 on Ubuntu.
The pom.xml says junit 3.8.1, and "mvn install" won't build the tests. I put in 4.2, and it builds. (A test fails, but I'm looking into that.)
$ diff pom.xml.orig pom.xml
14c14
< <version>3.8.1</version>
---
> <version>4.2</version>
A small thing. One test I had to comment out:
// underscores are now valid in tube names
// try {
// client.useTube("foobar_");
// } catch ( Exception e ) {
// fail(e.getMessage());
// }
It would have been helpful to know _s are as of beanstalk 1.4.4: http://kr.github.com/beanstalkd/2010/03/09/1.4.4-release-notes.html. I'm running 1.4.3-1 because that's the latest Ubuntu 10.4 stable package.
Perhaps change the comment to
// underscores are valid in tube names >= beanstalk 1.4.4.
The latest version on Maven Central is 1.4.6
version 1.7.0
Steps to reproduce:
Client client = new ClientImpl("localhost", 11300);
client.reserve(null);
Inside ProtocolHandler.readInputStream in while loop code doesn't handle -1 returned from is.read(); Might be something like this:
while (true) {
byte b = (byte) is.read();
if (b == -1) {
throw new IOException("The end of InputStream is reached");
}
baos.write(b);
if (b == '\n' && lastByteWasReturnByte) {
break;
}
lastByteWasReturnByte = (b == '\r');
}
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:71)
at com.surftools.BeanstalkClientImpl.ProtocolHandler.readInputStream(ProtocolHandler.java:130)
at com.surftools.BeanstalkClientImpl.ProtocolHandler.processRequest(ProtocolHandler.java:72)
at com.surftools.BeanstalkClientImpl.ClientImpl.reserve(ClientImpl.java:100)
The puts look fine (0-1ms). However, I bet Maven or Junit thinks anything ending in "Test" needs a unit test, so it's saying:
<<< ERROR!
java.lang.Exception: No runnable methods
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:34)
...
I renamed to TimedPutTester, and it skips that file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.