So, ive been trying this out and it hasn't quite been working out.
First, im getting a inputstream from a Process. Then i'm getting a
channel from it
using Channels/newChannel. This gives me a ReadableByteChannelImpl
which claims to implemen tInterruptibleChannel
http://www.docjar.org/docs/api/java/nio/channels/Channels$ReadableByteChannelImpl.html#read%28ByteBuffer%29
However, when i attempt to close the channel or do (.interrupt *th*)
it stalls on me. Is there something i'm missing?
Also, im not quite sure how to register it with a selector because it
doesn't have the register method defined.
(def *ch* (Channels/newChannel input-stream))
(def *th* (with-thread nil ;;start a new thread
(.read
(Channels/newChannel input-stream) ;;produces
#<ReadableByteChannelImpl java.nio.channels.Channels
$readablebytechanneli...@1c68e73>
(allocate-byte-buffer 1024) ;;create new byte buffer
)))
(.close *ch*) ;;stalls so does (.interrupt *ch*)
I'm guessing the (Thread/sleep ) will work for me but i'm still not
sure why this is not working.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---