congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SelectorHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
SelectorHandler
in
org.glassfish.grizzly.nio

Best Java code snippets using org.glassfish.grizzly.nio.SelectorHandler (Showing top 20 results out of 315)

origin: org.glassfish.grizzly/grizzly-http-server-core

public void detachSelectorRunner() throws IOException {
  final SelectorRunner selectorRunnerLocal = this.selectorRunner;
  this.selectionKey = null;
  this.selectorRunner = null;
  if (selectorRunnerLocal != null) {
    transport.getSelectorHandler().deregisterChannel(selectorRunnerLocal,
      channel);
  }
}
origin: javaee/grizzly

@Override
public void registerChannel(final SelectableChannel channel,
    final int interestOps, final Object attachment) throws IOException {
  transport.getSelectorHandler().registerChannel(it.next(), 
      channel, interestOps, attachment);
}
origin: javaee/grizzly

@Override
public void registerChannelAsync(
    final SelectableChannel channel, final int interestOps,
    final Object attachment,
    final CompletionHandler<RegisterChannelResult> completionHandler) {
  transport.getSelectorHandler().registerChannelAsync(
      it.next(), channel, interestOps, attachment, completionHandler);
}
origin: javaee/grizzly

  if (!selectorHandler.preSelect(this)) {
    return false;
  readyKeySet = selectorHandler.select(this);
  selectorWakeupFlag.set(false);
  selectorHandler.postSelect(this);
} catch (ClosedSelectorException e) {
  if (isRunning()) {
    if (selectorHandler.onSelectorClosed(this)) {
      return true;
origin: javaee/grizzly

@Override
public void simulateIOEvent(final IOEvent ioEvent) throws IOException {
  if (!isOpen()) {
    // don't simulate IOEvent for closed connection
    return;
  }
  
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  switch (ioEvent) {
    case WRITE:
      selectorHandler.enque(selectorRunner, writeSimulatorRunnable, null);
      break;
    case READ:
      selectorHandler.enque(selectorRunner, readSimulatorRunnable, null);
      break;
    default:
      throw new IllegalArgumentException("We support only READ and WRITE events. Got " + ioEvent);
  }
}

origin: javaee/grizzly

@Override
public final void disableIOEvent(final IOEvent ioEvent) throws IOException {
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0) {
    return;
  }
  notifyIOEventDisabled(this, ioEvent);
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.deregisterKeyInterest(selectorRunner, selectionKey, interest);
}
origin: org.glassfish.grizzly/grizzly-http-server-core

@Override
public final void enableIOEvent(final IOEvent ioEvent) throws IOException {
  final boolean isOpRead = (ioEvent == IOEvent.READ);
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0 ||
      // don't register OP_READ for a connection scheduled to be closed
      (isOpRead && isCloseScheduled.get()) ||
      // don't register any OP for a closed connection
      closeReason != null) {
    return;
  }
  
  notifyIOEventEnabled(this, ioEvent);
  
  // if OP_READ was enabled at least once - isInitialReadRequired should be false
  isInitialReadRequired = isInitialReadRequired && !isOpRead;
  
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.registerKeyInterest(selectorRunner, selectionKey,
    interest);
}
origin: org.glassfish.grizzly/grizzly-websockets-server

notifyProbesClose(this);
transport.getSelectorHandler().execute(
    selectorRunner, new SelectorHandler.Task() {
origin: javaee/grizzly

  if (!selectorHandler.preSelect(this)) {
    return false;
  readyKeySet = selectorHandler.select(this);
  selectorWakeupFlag.set(false);
  selectorHandler.postSelect(this);
} catch (ClosedSelectorException e) {
  if (isRunning()) {
    if (selectorHandler.onSelectorClosed(this)) {
      return true;
origin: javaee/grizzly

@Override
public void simulateIOEvent(final IOEvent ioEvent) throws IOException {
  if (!isOpen()) {
    // don't simulate IOEvent for closed connection
    return;
  }
  
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  switch (ioEvent) {
    case WRITE:
      selectorHandler.enque(selectorRunner, writeSimulatorRunnable, null);
      break;
    case READ:
      selectorHandler.enque(selectorRunner, readSimulatorRunnable, null);
      break;
    default:
      throw new IllegalArgumentException("We support only READ and WRITE events. Got " + ioEvent);
  }
}

origin: javaee/grizzly

@Override
public final void disableIOEvent(final IOEvent ioEvent) throws IOException {
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0) {
    return;
  }
  notifyIOEventDisabled(this, ioEvent);
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.deregisterKeyInterest(selectorRunner, selectionKey, interest);
}
origin: javaee/grizzly

@Override
public final void enableIOEvent(final IOEvent ioEvent) throws IOException {
  final boolean isOpRead = (ioEvent == IOEvent.READ);
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0 ||
      // don't register OP_READ for a connection scheduled to be closed
      (isOpRead && isCloseScheduled.get()) ||
      // don't register any OP for a closed connection
      closeReason != null) {
    return;
  }
  
  notifyIOEventEnabled(this, ioEvent);
  
  // if OP_READ was enabled at least once - isInitialReadRequired should be false
  isInitialReadRequired = isInitialReadRequired && !isOpRead;
  
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.registerKeyInterest(selectorRunner, selectionKey,
    interest);
}
origin: javaee/grizzly

notifyProbesClose(this);
transport.getSelectorHandler().execute(
    selectorRunner, new SelectorHandler.Task() {
origin: org.mule.glassfish.grizzly/grizzly-framework

  if (!selectorHandler.preSelect(this)) {
    return false;
  readyKeySet = selectorHandler.select(this);
  selectorWakeupFlag.set(false);
  selectorHandler.postSelect(this);
} catch (ClosedSelectorException e) {
  if (isRunning()) {
    if (selectorHandler.onSelectorClosed(this)) {
      return true;
origin: javaee/grizzly

@Override
public void registerChannel(final SelectableChannel channel,
    final int interestOps, final Object attachment) throws IOException {
  transport.getSelectorHandler().registerChannel(it.next(), 
      channel, interestOps, attachment);
}
origin: javaee/grizzly

public void detachSelectorRunner() throws IOException {
  final SelectorRunner selectorRunnerLocal = this.selectorRunner;
  this.selectionKey = null;
  this.selectorRunner = null;
  if (selectorRunnerLocal != null) {
    transport.getSelectorHandler().deregisterChannel(selectorRunnerLocal,
      channel);
  }
}
origin: javaee/grizzly

@Override
public void registerServiceChannelAsync(
    final SelectableChannel channel, final int interestOps,
    final Object attachment,
    final CompletionHandler<RegisterChannelResult> completionHandler) {
  
  transport.getSelectorHandler().registerChannelAsync(
      it.nextService(), channel, interestOps,
      attachment, completionHandler);
}

origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
public void executeInEventThread(final IOEvent event, final Runnable runnable) {
  final Executor threadPool = transport.getIOStrategy()
      .getThreadPoolFor(this, event);
  if (threadPool == null) {
    transport.getSelectorHandler().enque(selectorRunner,
        new SelectorHandler.Task() {
          @Override
          public boolean run() throws Exception {
            runnable.run();
            return true;
          }
        }, null);
  } else {
    threadPool.execute(runnable);
  }
}

origin: javaee/grizzly

@Override
public final void disableIOEvent(final IOEvent ioEvent) throws IOException {
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0) {
    return;
  }
  notifyIOEventDisabled(this, ioEvent);
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.deregisterKeyInterest(selectorRunner, selectionKey, interest);
}
origin: javaee/grizzly

@Override
public final void enableIOEvent(final IOEvent ioEvent) throws IOException {
  final boolean isOpRead = (ioEvent == IOEvent.READ);
  final int interest = ioEvent.getSelectionKeyInterest();
  if (interest == 0 ||
      // don't register OP_READ for a connection scheduled to be closed
      (isOpRead && isCloseScheduled.get()) ||
      // don't register any OP for a closed connection
      closeReason != null) {
    return;
  }
  
  notifyIOEventEnabled(this, ioEvent);
  
  // if OP_READ was enabled at least once - isInitialReadRequired should be false
  isInitialReadRequired = isInitialReadRequired && !isOpRead;
  
  final SelectorHandler selectorHandler = transport.getSelectorHandler();
  selectorHandler.registerKeyInterest(selectorRunner, selectionKey,
    interest);
}
org.glassfish.grizzly.nioSelectorHandler

Most used methods

  • deregisterChannel
    Deregister the channel from the SelectorRunner's Selector.
  • registerChannel
  • registerChannelAsync
  • deregisterKeyInterest
    Deregisters SelectionKey interest. This method must be called from the SelectorRunner's thread only!
  • enque
    Execute task in a selector thread. Unlike #execute(org.glassfish.grizzly.nio.SelectorRunner,org.glas
  • execute
    Execute task in a selector thread. Unlike #enque(org.glassfish.grizzly.nio.SelectorRunner,org.glassf
  • onSelectorClosed
  • postSelect
  • preSelect
  • registerKeyInterest
  • select
  • select

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now