Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > [java.nio] Blocking mode for a while - How ?

Reply
Thread Tools

[java.nio] Blocking mode for a while - How ?

 
 
xEM
Guest
Posts: n/a
 
      04-27-2004
I'm using selector to manage connection on server. When server get an
incomming connection register this connection in non-blocking mode for
making readiness selection on it. In some moment i want to operate
with clients channels with blocking mode... but i can't change channel
to blocking mode, because is registered with selector in non-blocking
mode - i get IllegalBlockingModeException. How can i operate for a
while in blocking mode, but not to lose possibility readiness
selection on channel?


--
pozdr.
~xEM
 
Reply With Quote
 
 
 
 
HDSkiFreak
Guest
Posts: n/a
 
      05-10-2004
GReetings:

if your channel inherits from an AbstractSelectableChannel (all
sockets do), then you can use the call:

Object mutex = channel.blockingLock()
and wrap your blocking sections in a synchronized segment using the
returned mutex object.

Look at the NIO guide, or check out the O'Reilly NIO book for
examples. You can also try google'ing the API call for some examples.

Best Regards,

HDSkiFreak

On Tue, 27 Apr 2004 10:41:48 +0000 (UTC), xEM <(E-Mail Removed)> wrote:

>I'm using selector to manage connection on server. When server get an
>incomming connection register this connection in non-blocking mode for
>making readiness selection on it. In some moment i want to operate
>with clients channels with blocking mode... but i can't change channel
>to blocking mode, because is registered with selector in non-blocking
>mode - i get IllegalBlockingModeException. How can i operate for a
>while in blocking mode, but not to lose possibility readiness
>selection on channel?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mmm-mode, python-mode and doctest-mode? Edward Loper Python 0 08-09-2007 05:40 AM
re: mmm-mode, python-mode and doctest-mode? John J Lee Python 0 08-07-2007 07:49 PM
re: mmm-mode, python-mode and doctest-mode? Edward Loper Python 0 08-07-2007 08:58 AM
mmm-mode, python-mode and doctest-mode? John J Lee Python 3 12-01-2005 08:35 PM
Safe Mode (?) - It is meant to be normal mode but looks like safe mode English Patient Computer Support 3 10-03-2004 11:10 PM



Advertisments