public Selector createSelector ( ) { selectorSync . lock ( ) ; try { Selector selector = Selector . open ( ) ; assert ( selector != null ) ; selectors . add ( selector ) ; return selector ; } catch ( IOException e ) { throw new ZError . IOException ( e ) ; } finally { selectorSync . unlock ( ) ; } }
Creates a Selector that will be closed when the context is destroyed .