• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DatagramChannel always writable?

 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think a Selector will find a DatagramChannel always writable. Could you confirm it?
If this is the case, I do not need the following technique I tested by an example.

If the selector found the channel always writable I could call doWrite within the first if. Even, I wouldn't need fiddling with the interest set, the boolean variable would suffice.
What dou you think?
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I am using now is a call to the method that updates the interest in writing just before the call to select. Still the event-dispatching thread wakes up selector. Whether the selector has some IO event to notify or not, after it was awaken the next iteration calls the method mentioned above, and as a consequence select() returns immediately notifying that we can perform a writing operation.
 
reply
    Bookmark Topic Watch Topic
  • New Topic