congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.jboss.netty.handler.timeout
Code IndexAdd Tabnine to your IDE (free)

How to use org.jboss.netty.handler.timeout

Best Java code snippets using org.jboss.netty.handler.timeout (Showing top 20 results out of 315)

origin: io.netty/netty

public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
  destroy(ctx);
}
origin: io.netty/netty

public void beforeRemove(ChannelHandlerContext ctx) throws Exception {
  destroy(ctx);
}
origin: apache/hive

 @Override
 public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
  if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) {
   e.getChannel().close();
  }
 }
}
origin: apache/hive

  public HttpPipelineFactory(Configuration conf, Timer timer) throws Exception {
   SHUFFLE = getShuffle(conf);
   // TODO Setup SSL Shuffle
//      if (conf.getBoolean(MRConfig.SHUFFLE_SSL_ENABLED_KEY,
//                          MRConfig.SHUFFLE_SSL_ENABLED_DEFAULT)) {
//        LOG.info("Encrypted shuffle is enabled.");
//        sslFactory = new SSLFactory(SSLFactory.Mode.SERVER, conf);
//        sslFactory.init();
//      }
   this.idleStateHandler = new IdleStateHandler(timer, 0, connectionKeepAliveTimeOut, 0);
  }

origin: io.netty/netty

@Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
    throws Exception {
  if (e instanceof IdleStateEvent) {
    channelIdle(ctx, (IdleStateEvent) e);
  } else {
    super.handleUpstream(ctx, e);
  }
}
origin: io.netty/netty

@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
    throws Exception {
  long timeoutMillis = getTimeoutMillis(e);
  if (timeoutMillis > 0) {
    // Set timeout only when getTimeoutMillis() returns a positive value.
    ChannelFuture future = e.getFuture();
    final Timeout timeout = timer.newTimeout(
        new WriteTimeoutTask(ctx, future),
        timeoutMillis, TimeUnit.MILLISECONDS);
    future.addListener(new TimeoutCanceller(timeout));
  }
  super.writeRequested(ctx, e);
}
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);
  }
}
origin: io.netty/netty

@Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
    throws Exception {
  if (e instanceof IdleStateEvent) {
    channelIdle(ctx, (IdleStateEvent) e);
  } else {
    super.handleUpstream(ctx, e);
  }
}
origin: io.netty/netty

  public void run() {
    try {
      readTimedOut(ctx);
    } catch (Throwable t) {
      fireExceptionCaught(ctx, t);
    }
  }
});
origin: io.netty/netty

  public void run() {
    try {
      channelIdle(ctx, state, lastActivityTimeMillis);
    } catch (Throwable t) {
      fireExceptionCaught(ctx, t);
    }
  }
});
origin: io.netty/netty

  public void run() {
    try {
      writeTimedOut(ctx);
    } catch (Throwable t) {
      fireExceptionCaught(ctx, t);
    }
  }
});
origin: io.netty/netty

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  // This method will be invoked only if this handler was added
  // before channelOpen event is fired.  If a user adds this handler
  // after the channelOpen event, initialize() will be called by beforeAdd().
  initialize(ctx);
  ctx.sendUpstream(e);
}
origin: io.netty/netty

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  // This method will be invoked only if this handler was added
  // before channelOpen event is fired.  If a user adds this handler
  // after the channelOpen event, initialize() will be called by beforeAdd().
  initialize(ctx);
  ctx.sendUpstream(e);
}
origin: io.netty/netty

private static void destroy(ChannelHandlerContext ctx) {
  State state = state(ctx);
  synchronized (state) {
    if (state.state != 1) {
      return;
    }
    state.state = 2;
  }
  if (state.timeout != null) {
    state.timeout.cancel();
    state.timeout = null;
  }
}
origin: io.netty/netty

public ChannelFuture getFuture() {
  return succeededFuture(getChannel());
}
origin: io.netty/netty

private static State state(ChannelHandlerContext ctx) {
  State state;
  synchronized (ctx) {
    // FIXME: It could have been better if there is setAttachmentIfAbsent().
    state = (State) ctx.getAttachment();
    if (state != null) {
      return state;
    }
    state = new State();
    ctx.setAttachment(state);
  }
  return state;
}
origin: io.netty/netty

protected void channelIdle(
    ChannelHandlerContext ctx, IdleState state, long lastActivityTimeMillis) throws Exception {
  ctx.sendUpstream(new DefaultIdleStateEvent(ctx.getChannel(), state, lastActivityTimeMillis));
}
origin: io.netty/netty

private static State state(ChannelHandlerContext ctx) {
  State state;
  synchronized (ctx) {
    // FIXME: It could have been better if there is setAttachmentIfAbsent().
    state = (State) ctx.getAttachment();
    if (state != null) {
      return state;
    }
    state = new State();
    ctx.setAttachment(state);
  }
  return state;
}
origin: io.netty/netty

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  destroy(ctx);
  ctx.sendUpstream(e);
}
origin: io.netty/netty

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  destroy(ctx);
  ctx.sendUpstream(e);
}
org.jboss.netty.handler.timeout

Most used classes

  • ReadTimeoutHandler
    Raises a ReadTimeoutException when no data was read within a certain period of time. public class M
  • IdleStateHandler
    Triggers an IdleStateEvent when a Channel has not performed read, write, or both operation for a whi
  • IdleStateEvent
    A ChannelEvent that is triggered when a Channel has been idle for a while.
  • IdleStateAwareChannelHandler
    An extended SimpleChannelHandler that adds the handler method for an IdleStateEvent.
  • WriteTimeoutHandler
    Raises a WriteTimeoutException when no data was written within a certain period of time. public cla
  • IdleStateAwareChannelUpstreamHandler,
  • ReadTimeoutException,
  • DefaultIdleStateEvent,
  • IdleStateHandler$AllIdleTimeoutTask,
  • IdleStateHandler$ReaderIdleTimeoutTask,
  • IdleStateHandler$State,
  • IdleStateHandler$WriterIdleTimeoutTask,
  • ReadTimeoutHandler$ReadTimeoutTask,
  • ReadTimeoutHandler$State,
  • TimeoutException,
  • WriteTimeoutException,
  • WriteTimeoutHandler$TimeoutCanceller,
  • WriteTimeoutHandler$WriteTimeoutTask
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