On Tuesday 29 January 2008 11:39:29 pm Yang Zhang wrote:
> > 2. DatagramAcceptor takes an executor - I have never been able to find
> > any mention in the docs on what exactly gets submitted to this executor
> > (all I know is that it's not related to IO threads, which is
> > parameterized by the above int) - but experimentally, I found I cannot
> > pass in a single-threaded executor, since it seems that the call to
> > bind() for all but the first DatagramAcceptor will block. And I did not
> > add any filters.
[snip]
> public static void main(String[] args) throws Exception {
> InetAddress addr = InetAddress.getLocalHost();
> ExecutorService executor = Executors.newSingleThreadExecutor();
> for (int i = 0; i < 2; i++) {
> DatagramAcceptor a = new DatagramAcceptor(executor);
Move that DatagramAcceptor out of the loop and it works fine