Package com.yahoo.io

Class UpdateInterest


  • public class UpdateInterest
    extends java.lang.Object
    Command object to perform interest set updates. Workaround for NIO design flaw which makes it impossible to update the interest set of a SelectionKey while select() is in progress. There should be a more elegant way around this, but if it turns out to be performant enough we leave it like this.

    Of course, the ideal would be to have NIO fixed.

    Author:
    Bob Travis, Bjorn Borud
    • Constructor Summary

      Constructors 
      Constructor Description
      UpdateInterest​(java.nio.channels.SelectionKey key, int operation, boolean set)
      Create an object for encapsulating a interest set change request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doUpdate()
      This method is used for actually applying the updates to the SelectionKey in question at a time when it is safe to do so.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UpdateInterest

        public UpdateInterest​(java.nio.channels.SelectionKey key,
                              int operation,
                              boolean set)
        Create an object for encapsulating a interest set change request.
        Parameters:
        key - The key we wish to update
        operation - The operation we wish to set or remove
        set - Whether we want to set (true) or clear (false) the operation in the interest set
    • Method Detail

      • doUpdate

        public void doUpdate()
        This method is used for actually applying the updates to the SelectionKey in question at a time when it is safe to do so. If the SelectionKey has been invalidated in the meanwhile we do nothing.