Google Answers Logo
View Question
 
Q: Java.NIO interestOps blocking on Redhat 9..need fix! ( No Answer,   0 Comments )
Question  
Subject: Java.NIO interestOps blocking on Redhat 9..need fix!
Category: Computers > Programming
Asked by: davidusc-ga
List Price: $50.00
Posted: 24 Oct 2003 15:28 PDT
Expires: 23 Nov 2003 14:28 PST
Question ID: 269472
First off, here's my computer's configuration.
Red Hat 9, using j2sdk 1.4.2, packages I'm having trouble with
Java.NIO

The Problem:
java.NIO is supposedly non blocking. I've created a thread pool in
which each thread continuously checks sockets (or channels) for
incoming events. If a thread finds an incoming event, it removes the
readOps from the InterestOps. It does this in order to prevent the
other threads from repeating the events. The thread then reads/writes
data from/to the network socket and then tries to re-enable the
various interest operations so we can check for future events that
occur on this socket. It deadlocks on Linux here.. I can't re-enable
the interest operations.

This is what the java docs say about selection keys:

"Selection keys are safe for use by multiple concurrent threads. The 
operations of reading and writing the interest set will, in general,
be
synchronized with certain operations of the selector. Exactly how this
synchronization is performed is implementation-dependent: In a naive 
implementation, reading or writing the interest set may block 
indefinitely if a selection operation is already in progress; in a 
high-performance implementation, reading or writing the interest set
may
block briefly, if at all. In any case, a selection operation will
always
use the interest-set value that was current at the moment that the 
operation began."

I can't see how one can use multiple threads with NIO given the
current behavior. Is there a way to get around this?. I need multiple
threads to check sockets for events. I will not change the kernel on
Redhat, even though I've tried and it still does not work.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy