synchronized because selector is not threadsafe