Tabnine Logo
NioWorker
Code IndexAdd Tabnine to your IDE (free)

How to use
NioWorker
in
org.jboss.netty.channel.socket.nio

Best Java code snippets using org.jboss.netty.channel.socket.nio.NioWorker (Showing top 20 results out of 315)

origin: io.netty/netty

  future.setFailure(new ClosedChannelException());
close(channel, succeededFuture(channel));
return;
  future.setFailure(e);
close(channel, succeededFuture(channel));
if (!(e instanceof ClosedChannelException)) {
  throw new ChannelException(
origin: io.netty/netty

@Override
protected boolean scheduleWriteIfNecessary(final AbstractNioChannel<?> channel) {
  final Thread currentThread = Thread.currentThread();
  final Thread workerThread = thread;
  if (currentThread != workerThread) {
    if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
      registerTask(channel.writeTask);
    }
    return true;
  }
  return false;
}
origin: io.netty/netty

  @Override
  protected NioWorker newWorker(Executor executor) {
    return new NioWorker(executor, determiner);
  }
}
origin: kaazing/gateway

private static boolean isInIoThread(NioWorker worker) {
  final Thread[] ioThread = new Thread[]{null};
  worker.executeInIoThread(new Runnable() {
    @Override
    public void run() {
      ioThread[0] = currentThread();
    }
  });
  boolean aligned = ioThread[0] == currentThread();
  assert aligned : format("Current thread %s does not match I/O thread %s", currentThread(), ioThread[0]);
  return aligned;
}
origin: io.netty/netty

private static void registerAcceptedChannel(NioServerSocketChannel parent, SocketChannel acceptedSocket,
                   Thread currentThread) {
  try {
    ChannelSink sink = parent.getPipeline().getSink();
    ChannelPipeline pipeline =
        parent.getConfig().getPipelineFactory().getPipeline();
    NioWorker worker = parent.workerPool.nextWorker();
    worker.register(new NioAcceptedSocketChannel(
        parent.getFactory(), pipeline, parent, sink
        , acceptedSocket,
        worker, currentThread), null);
  } catch (Exception e) {
    if (logger.isWarnEnabled()) {
      logger.warn(
          "Failed to initialize an accepted socket.", e);
    }
    try {
      acceptedSocket.close();
    } catch (IOException e2) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to close a partially accepted socket.",
            e2);
      }
    }
  }
}
origin: kaazing/gateway

void writeFromUserCodeUdp(final AbstractNioChannel<?> channel) {
  assert channel instanceof NioDatagramChannel;
  /*
   * Note that we are not checking if the channel is connected. Connected
   * has a different meaning in UDP and means that the channels socket is
   * configured to only send and receive from a given remote peer.
   */
  if (!channel.isBound()) {
    cleanUpWriteBuffer(channel);
    return;
  }
  if (scheduleWriteIfNecessary(channel)) {
    return;
  }
  // From here, we are sure Thread.currentThread() == workerThread.
  if (channel.writeSuspended) {
    return;
  }
  if (channel.inWriteNowLoop) {
    return;
  }
  write0(channel);
}
origin: kaazing/gateway

  setOpWrite(channel);
} else if (removeOpWrite) {
  clearOpWrite(channel);
origin: org.vert-x/vertx-core

public void runOnCorrectThread(NioSocketChannel nch, Runnable runnable) {
 nch.getWorker().executeInIoThread(runnable, false);
}
origin: stackoverflow.com

 NioWorker worker = parent.workerPool.nextWorker();
worker.register(new NioAcceptedSocketChannel(
    parent.getFactory(), pipeline, parent, sink
    , acceptedSocket,
    worker, currentThread), null);
origin: org.vert-x/vertx-core

public void execute(Runnable task) {
 worker.executeInIoThread(wrapTask(task), true);
}
origin: nyankosama/simple-netty-source

private static void registerAcceptedChannel(NioServerSocketChannel parent, SocketChannel acceptedSocket,
                   Thread currentThread) {
  try {
    ChannelSink sink = parent.getPipeline().getSink();
    ChannelPipeline pipeline =
        parent.getConfig().getPipelineFactory().getPipeline();
    NioWorker worker = parent.workerPool.nextWorker();
    worker.register(new NioAcceptedSocketChannel(
        parent.getFactory(), pipeline, parent, sink
        , acceptedSocket,
        worker, currentThread), null);
  } catch (Exception e) {
    if (logger.isWarnEnabled()) {
      logger.warn(
          "Failed to initialize an accepted socket.", e);
    }
    try {
      acceptedSocket.close();
    } catch (IOException e2) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to close a partially accepted socket.",
            e2);
      }
    }
  }
}
origin: io.netty/netty

close(channel, succeededFuture(channel));
return false;
origin: kaazing/gateway

@Override
protected boolean scheduleWriteIfNecessary(final AbstractNioChannel<?> channel) {
  final Thread currentThread = Thread.currentThread();
  final Thread workerThread = thread;
  if (currentThread != workerThread) {
    if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
      registerTask(channel.writeTask);
    }
    return true;
  }
  return false;
}
origin: nyankosama/simple-netty-source

  @Override
  @Deprecated
  protected NioWorker createWorker(Executor executor) {
    return new NioWorker(executor, determiner);
  }
}
origin: com.facebook.nifty/nifty-client

@Override
public void executeInIoThread(Runnable runnable)
{
  NioSocketChannel nioSocketChannel = (NioSocketChannel) getNettyChannel();
  nioSocketChannel.getWorker().executeInIoThread(runnable, true);
}
origin: kaazing/gateway

private static void registerAcceptedChannel(NioServerSocketChannel parent, SocketChannel acceptedSocket,
                   Thread currentThread) {
  try {
    ChannelSink sink = parent.getPipeline().getSink();
    ChannelPipeline pipeline =
        parent.getConfig().getPipelineFactory().getPipeline();
    NioWorker worker = parent.workerPool.nextWorker();
    worker.register(new NioAcceptedSocketChannel(
        parent.getFactory(), pipeline, parent, sink
        , acceptedSocket,
        worker, currentThread), null);
  } catch (Exception e) {
    if (logger.isWarnEnabled()) {
      logger.warn(
          "Failed to initialize an accepted socket.", e);
    }
    try {
      acceptedSocket.close();
    } catch (IOException e2) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to close a partially accepted socket.",
            e2);
      }
    }
  }
}
origin: kaazing/gateway

@Override
protected void close(SelectionKey k) {
  ReadDispatcher dispatcher = (ReadDispatcher) k.attachment();
  AbstractNioChannel<?> ch = dispatcher.channel();
  close(ch, succeededFuture(ch));
}
origin: nyankosama/simple-netty-source

@Override
protected boolean scheduleWriteIfNecessary(final AbstractNioChannel<?> channel) {
  final Thread currentThread = Thread.currentThread();
  final Thread workerThread = thread;
  if (currentThread != workerThread) {
    if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
      registerTask(channel.writeTask);
    }
    return true;
  }
  return false;
}
origin: k3po/k3po

  @Override
  public void operationComplete(ChannelFuture future) throws Exception {
    ((NioSocketChannel) ctx.getChannel()).getWorker().executeInIoThread(() -> {
      try {
        prepareReceived(ctx, evt);
      } catch (Exception e) {
        sendErrorMessage(ctx, e);
      }
    }, true);
  }
});
origin: nyankosama/simple-netty-source

  future.setFailure(new ClosedChannelException());
close(channel, succeededFuture(channel));
return;
  future.setFailure(e);
close(channel, succeededFuture(channel));
if (!(e instanceof ClosedChannelException)) {
  throw new ChannelException(
org.jboss.netty.channel.socket.nioNioWorker

Most used methods

  • executeInIoThread
  • register
  • close
  • registerTask
  • <init>
  • cleanUpWriteBuffer
  • clearOpWrite
  • scheduleWriteIfNecessary
  • setOpWrite
  • shutdown
  • write0
  • write0Udp
  • write0,
  • write0Udp,
  • writeFromUserCodeUdp

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSharedPreferences (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Kernel (java.awt.image)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JComboBox (javax.swing)
  • Top plugins for Android Studio
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