Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8925

Channel Switch in GO, can I do this with java.nio

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Channel Switch in GO, can I do this with java.nio
Date 2011-10-17 19:02 +0200
Organization albasani.net
Message-ID <j7hn3d$pmt$1@news.albasani.net> (permalink)

Show all headers | View raw


Dear All,

I am just wondering whether a Go programming
language construct can be done in Java by
means of some standard packages.

The Go programming language construct, is the
switch statement over channels:

   switch {
     c <- channel1:
        /* do something 1 */
     c <- channel2:
        /* do something 2 */
   }

I interpret this that the code will try to fetch
data from channel1 and channel2, and depending on
which channel has fist some data, the corresponding
code will be executed?

How could this be done in Java? I have the feeling
that read() does not work since it blocks, and that
available() would not work since it would involve
polling. So something else could solve the problem...

Best Regards

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-17 19:02 +0200
  Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 10:22 -0700
    Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-17 20:15 +0200
      Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 12:44 -0700
        Re: Channel Switch in GO, can I do this with java.nio Lew <lewbloch@gmail.com> - 2011-10-17 15:58 -0700
          Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-17 18:59 -0700
            Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-18 09:16 +0200
            Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-18 09:20 +0200
              Re: Channel Switch in GO, can I do this with java.nio markspace <-@.> - 2011-10-18 07:49 -0700
                Re: Channel Switch in GO, can I do this with java.nio Jan Burse <janburse@fastmail.fm> - 2011-10-19 16:17 +0200

csiph-web