Comments (18)
what is your java version? I tested with jdk1.6.0_33 and I didn't got the error.
from jeromq.
mvn test
fails on JDK 7 (Oracle JDK 7u6 in my case). mvn compile
succeeds.
from jeromq.
Platform: Mac OSX 10.8
java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)
from jeromq.
I think I need to test more on java7.
michaelklishin,
what was your mvn test result?
here are known test failures at a certain network configuration. I'm going to ignore them.
Failed tests:
testInvaid(zmq.TestAddress): Expected exception: java.lang.IllegalArgumentException
testConnectResolve(zmq.TestConnectResolve)
from jeromq.
I am running on Java 6 (java version "1.6.0_33") on OS X 10.8.
testProxyTcp() is getting stuck because of this IOException. If I ignore this test, all other tests pass.
Exception in thread "iothread-2" zmq.ZException$IOException: java.io.IOException: Broken pipe
at zmq.Signaler.send(Signaler.java:79)
at zmq.Mailbox.send(Mailbox.java:92)
at zmq.Ctx.send_command(Ctx.java:355)
at zmq.ZObject.send_command(ZObject.java:59)
at zmq.ZObject.send_command(ZObject.java:54)
at zmq.ZObject.send_pipe_term(ZObject.java:76)
at zmq.Pipe.terminate(Pipe.java:430)
at zmq.SessionBase.process_term(SessionBase.java:375)
at zmq.ZObject.process_command(ZObject.java:245)
at zmq.IOThread.in_event(IOThread.java:88)
at zmq.Poller.run(Poller.java:219)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.FileDispatcher.write(FileDispatcher.java:39)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69)
at sun.nio.ch.IOUtil.write(IOUtil.java:40)
at sun.nio.ch.SinkChannelImpl.write(SinkChannelImpl.java:149)
at zmq.Signaler.send(Signaler.java:72)
... 11 more
Exception in thread "Thread-2" java.lang.IllegalStateException
at zmq.SocketBase.recv(SocketBase.java:769)
at zmq.Device.device(Device.java:52)
at zmq.ZMQ.zmq_device(ZMQ.java:335)
at zmq.TestProxyTcp$Main.run(TestProxyTcp.java:275)
from jeromq.
Please ignore my last comment, I did not update your changes today. After pulling latest code base, I am able to run the tests fine. All tests pass for me on Java 6.
from jeromq.
kwo,
It looks like your maven might choose openjdk.
getRemoteAddress exist only at openjdk's SocketChannel.
My test with oracle jdk7 works fine.
$ mvn -version
Apache Maven 3.0.3 (r1075438; 2011-03-01 02:31:09+0900)
Maven home: /opt/local/maven
Java version: 1.7.0_06, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_06.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8", arch: "x86_64", family: "mac"
from jeromq.
I believe the problem is, there were several new APIs added to SocketChannel in JDK 7. DummySocketChannel has to implement all those new methods in order to compile under JDK 7. getRemoteAddress() in SocketChannel (http://docs.oracle.com/javase/7/docs/api/java/nio/channels/SocketChannel.html#getRemoteAddress()) is a standard API that was introduced in JDK 7.
mvn test fails for me under Oracle JDK 7 due to this incompatibility. The only way I can think of is to stick with either JDK 6 or JDK 7, it is not possible to support both unfortunately.
from jeromq.
Ah, you're right. I didn't look into jdk7 doc deeply and I forgot to run mvn clean.
I just simply added getRemoteAddress at the dummy channel. Please pull the latest
from jeromq.
@aruld is right: in JDK 7, there is a method added to java.nio.channels.SocketChannel that has java.net.SocketOption in the signature. That class is new in JDK 7. This means, in jeromq's particular case, tests won't compile under JDK 6 (the library should work fine).
Because JDK 7 is inevitable future and the only (recent) JDK you can get for recent OS X releases, I'd recommend going with 7 for development. These changes to the dummy channel are sufficient:
diff --git a/src/test/java/zmq/Helper.java b/src/test/java/zmq/Helper.java
index 0c34d1c..7d52b74 100644
--- a/src/test/java/zmq/Helper.java
+++ b/src/test/java/zmq/Helper.java
@@ -25,11 +25,13 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketAddress;
+import java.net.SocketOption;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
@@ -49,8 +51,43 @@ public class Helper {
protected DummySocketChannel(SelectorProvider provider) {
super(provider);
}
-
- public DummySocketChannel() {
+
+ @Override
+ public SocketChannel bind(SocketAddress local) throws IOException {
+ return null;
+ }
+
+ @Override
+ public SocketAddress getLocalAddress() throws IOException {
+ return null;
+ }
+
+ @Override
+ public <T> SocketChannel setOption(SocketOption<T> name, T value) throws IOException {
+ return null;
+ }
+
+ @Override
+ public <T> T getOption(SocketOption<T> name) throws IOException {
+ return null;
+ }
+
+ @Override
+ public Set<SocketOption<?>> supportedOptions() {
+ return null;
+ }
+
+ @Override
+ public SocketChannel shutdownInput() throws IOException {
+ return null;
+ }
+
+ @Override
+ public SocketChannel shutdownOutput() throws IOException {
+ return null;
+ }
+
+ public DummySocketChannel() {
this(64);
}
public DummySocketChannel(int bufsize) {
from jeromq.
I uninstalled OpenJDK as I wasn't sure which JVM maven was using. I pulled just now and am still getting an error albeit a different one:
[ERROR] /Users/karl/projects/jeromq/src/test/java/zmq/Helper.java:[45,18] error: DummySocketChannel is not abstract and does not override abstract method shutdownOutput() in SocketChannel
from jeromq.
@kwo It won't work until all the abstract methods are implemented from JDK 7 SocketChannel (shown in @michaelklishin patch).
I personally think Java 6 should be supported as it is widely used everywhere. I see the DummySocketChannel is only used in tests (TestEncoder), is there a different approach to implement those tests?
from jeromq.
One way is to replace that dummy channel with a mock (since it already does not do much). JDK 6 will be supported, the issue is with a particular part of the test suite, not the library.
from jeromq.
Thanks for ideas.
I narrowed down base class of DummySocketChannel from SocketChannel to WritableByteChannel.
WritableByteChannel is jdk6/7 compatible.
from jeromq.
Just pulled and all tests pass on JDK7
from jeromq.
also tested on 1.6.0_33 and all tests pass
from jeromq.
Closing issue: works on both JDK6 and 7
from jeromq.
Now that both JDK 6 and JDK 7 are supported, I recommend adding jeromq to travis-ci.org to run CI against 3 JDKs:
I will be happy to help if you have questions.
from jeromq.
Related Issues (20)
- xSub socket subscription throws IllegalArgumentException HOT 1
- ZError Error number description HOT 1
- Socket#connect hangs for ever on wrong host/port
- ZCertStore's loadFiles recursion logic is incorrect only recursing into first subdir. HOT 3
- Will there be another release? HOT 3
- Problem: Changelog is out of date
- Problem: No clear examples for Curve usage
- Problem: No automated way to deploy a release to maven central HOT 2
- socket.CLIENT does not seem to do anything in java8 HOT 2
- ipc:// protocol with zeromq. Java does support UNIX domain socket since JDK 16 HOT 1
- periodic index-out-of-bounds error HOT 9
- issue with kvmsg get/set operation HOT 2
- NPE after uplift jeromq from 0.5.2 to 0.5.3 HOT 3
- 0.5.4 and 0.6 versions HOT 3
- MsgsendBlockAndCpuIs100% HOT 7
- ipc HOT 3
- New client cannot receive any data in PUB/SUB mode HOT 1
- How to split `ZMsg` in reply envelope and request? HOT 1
- reaper-1 thread consuming 99.9% CPU HOT 2
- DEALER recv sometimes hangs HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jeromq.