Comments (8)
AFAIK, This is the documented behaviour of java.nio.channels.spi.AbstractInterruptibleChannel.
You need to use begin()/end() pairs, if you want to interrupt the thread.
See https://docs.oracle.com/javase/7/docs/api/java/nio/channels/spi/AbstractInterruptibleChannel.html#be
from jnr-unixsocket.
@felfert but begin/end are protected methods, so I can't call them directly. Surely it is the JNR implementation of UnixServerSocketChannel#accept that should be calling them?
from jnr-unixsocket.
Specifically, shouldn't this line be wrapped in begin/end pairs?
from jnr-unixsocket.
@gregw I think you're right. Can you help us patch this?
from jnr-unixsocket.
@headius #25 is a PR that adds begin/end calls. It makes it a little bit better, but doesn't generally fix the problem? At least not on Linux Tile440 4.2.0-30-generic #36-Ubuntu SMP Fri Feb 26 00:58:07 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
from jnr-unixsocket.
Fix this for 0.14.
from jnr-unixsocket.
I think the way to do accept()
with an interrupt or timeout is to call select()
first, check if the socket is ready, and then call accept()
knowing there's a connection to accept. You could set things up so that one of the sockets passed to select()
is something that a thread wanting to interrupt it could close or otherwise signal, separate from the socket you're actually trying to accept on, and you could implement a version of the api with a timeout.
from jnr-unixsocket.
Fixed in #65
from jnr-unixsocket.
Related Issues (20)
- unit test BasicFunctionalityTest stalls when run with JDK 17 in M1 Mac HOT 1
- application run failed while built with native-image HOT 1
- Allow Setting Socket Type on Creation HOT 1
- jnr-unixsocket v0.23 and above forces osgi.ee;filter:="(&(osgi.e e=JavaSE)(version=9.0))" HOT 3
- Read response from server, Unix Datagram socket HOT 1
- Implement sendmsg to pass control messages HOT 1
- After channel close, read and write calls were using recycled file descriptor HOT 2
- UnixServer example doesn't work on Mac with either nc or socat HOT 8
- java.lang.UnsatisfiedLinkError: ÕҲ »µ½ ָ¶¨µ HOT 6
- Null PollSelectionKey attachment causes IllegalStateException in jetty HOT 1
- Support for AIX v7.2 64-bit
- Found interface org.objectweb.asm.ClassVisitor, but class was expected HOT 2
- Smoke test fails sporadically on MacOS
- on ppc64le credentials are wrongly parsed/obtained HOT 3
- Solaris can't set socket options HOT 11
- UnixServerSocketChannel extending java.nio.channels.ServerSocketChannel
- No exception while using PrintWriter and outputstream HOT 9
- Support for M1 Mac? HOT 4
- UnixClient fails sporadically on Darwin HOT 1
- Datagram support HOT 1
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 jnr-unixsocket.