Tabnine Logo
ReadTimeoutHandler$ReadTimeoutTask
Code IndexAdd Tabnine to your IDE (free)

How to use
ReadTimeoutHandler$ReadTimeoutTask
in
org.jboss.netty.handler.timeout

Best Java code snippets using org.jboss.netty.handler.timeout.ReadTimeoutHandler$ReadTimeoutTask (Showing top 2 results out of 315)

origin: io.netty/netty

public void run(Timeout timeout) throws Exception {
  if (timeout.isCancelled()) {
    return;
  }
  if (!ctx.getChannel().isOpen()) {
    return;
  }
  State state = (State) ctx.getAttachment();
  long currentTime = System.currentTimeMillis();
  long nextDelay = timeoutMillis - (currentTime - state.lastReadTime);
  if (nextDelay <= 0) {
    // Read timed out - set a new timeout and notify the callback.
    state.timeout =
      timer.newTimeout(this, timeoutMillis, TimeUnit.MILLISECONDS);
    fireReadTimedOut(ctx);
  } else {
    // Read occurred before the timeout - set a new timeout with shorter delay.
    state.timeout =
      timer.newTimeout(this, nextDelay, TimeUnit.MILLISECONDS);
  }
}
origin: io.netty/netty

private void initialize(ChannelHandlerContext ctx) {
  State state = state(ctx);
  // Avoid the case where destroy() is called before scheduling timeouts.
  // See: https://github.com/netty/netty/issues/143
  synchronized (state) {
    switch (state.state) {
    case 1:
    case 2:
      return;
    }
    state.state = 1;
  }
  if (timeoutMillis > 0) {
    state.timeout = timer.newTimeout(new ReadTimeoutTask(ctx), timeoutMillis, TimeUnit.MILLISECONDS);
  }
}
org.jboss.netty.handler.timeoutReadTimeoutHandler$ReadTimeoutTask

Most used methods

  • <init>
  • fireReadTimedOut

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • JList (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Sublime Text plugins
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