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

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

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

origin: apache/hive

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

  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    logger.info("In IDLE event handler for TCP...");
    
    //there are 3 states. READER/WRITER/ALL
    if (e.getState() == IdleState.ALL_IDLE){
      int statusCodeInt = 0;
      String statusCode = statusCodeInt + " SUCCESSFUL";
      String errMsg="idleTimeout to finish";
      
      tcpWorker.onComplete(tcpWorker.responseSb.toString(), false, 
          errMsg, errMsg, statusCode, statusCodeInt);
    }
  }
}
origin: k3po/k3po

  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    // Close idle UdpChildChannel (on server side) or NioDatagramChannel (client side)
    e.getChannel().close();
  }
}
origin: normanmaurer/niosmtp

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception {
  if (e.getState() == IdleState.ALL_IDLE) {
    throw new SMTPIdleException("Connection was idling for " + (System.currentTimeMillis()- e.getLastActivityTimeMillis()) + " ms");
  }
  super.channelIdle(ctx, e);
}
origin: eBay/parallec

  /**
   * this case is like a read timeout where did not get anything from the
   * server for a long time.
   * 
   * For UDP need to mark as error
   * 
   * @see org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler#channelIdle
   *      (org.jboss.netty.channel.ChannelHandlerContext,
   *      org.jboss.netty.handler.timeout.IdleStateEvent)
   */
  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    logger.debug("In IDLE event handler for UDP..timeout.");
    // there are 3 states. READER/WRITER/ALL
    if (e.getState() == IdleState.ALL_IDLE) {
      int statusCodeInt = 1;
      String statusCode = statusCodeInt + " FAILURE";
      String errMsg = "UDP idle (read) timeout";
      udpWorker.onComplete(udpWorker.responseSb.toString(), true,
          errMsg, errMsg, statusCode, statusCodeInt);
    }
  }
}
origin: org.onosproject/onos-of-ctl

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
    throws Exception {
  OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;
  OFMessage m = factory.buildEchoRequest().build();
  log.debug("Sending Echo Request on idle channel: {}",
      e.getChannel().getPipeline().getLast().toString());
  e.getChannel().write(Collections.singletonList(m));
  // XXX S some problems here -- echo request has no transaction id, and
  // echo reply is not correlated to the echo request.
}
origin: menacher/java-game-server

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
    throws Exception
{
  if(e.getState() == IdleState.ALL_IDLE){
    LOG.warn("Channel {} has been idle, it will be disconnected now: ",e.getChannel());
    e.getChannel().close();
  }
}
 
origin: io.parallec/parallec-core

  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    logger.info("In IDLE event handler for TCP...");
    
    //there are 3 states. READER/WRITER/ALL
    if (e.getState() == IdleState.ALL_IDLE){
      int statusCodeInt = 0;
      String statusCode = statusCodeInt + " SUCCESSFUL";
      String errMsg="idleTimeout to finish";
      
      tcpWorker.onComplete(tcpWorker.responseSb.toString(), false, 
          errMsg, errMsg, statusCode, statusCodeInt);
    }
  }
}
origin: os-libera/OpenVirteX

@Override
public void channelIdle(final ChannelHandlerContext ctx,
    final IdleStateEvent e) throws Exception {
  final OFMessage m = BasicFactory.getInstance().getMessage(
      OFType.ECHO_REQUEST);
  e.getChannel().write(Collections.singletonList(m));
}
origin: stackoverflow.com

 public class IdleStateAwareHandler extends IdleStateAwareChannelHandler {

  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    if (e.getState() == IdleState.READER_IDLE) {
      e.getChannel().write("heartbeat-reader_idle");
    }
    else if (e.getState() == IdleState.WRITER_IDLE) {
      Logger.getLogger(IdleStateAwareHandler.class.getName()).log(
          Level.WARNING, "WriteIdle detected, closing channel");
      e.getChannel().close();
      e.getChannel().write("heartbeat-writer_idle");
    }
    else if (e.getState() == IdleState.ALL_IDLE) {
      e.getChannel().write("heartbeat-all_idle");
    }
  }
}
origin: io.parallec/parallec-core

  /**
   * this case is like a read timeout where did not get anything from the
   * server for a long time.
   * 
   * For UDP need to mark as error
   * 
   * @see org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler#channelIdle
   *      (org.jboss.netty.channel.ChannelHandlerContext,
   *      org.jboss.netty.handler.timeout.IdleStateEvent)
   */
  @Override
  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
    logger.debug("In IDLE event handler for UDP..timeout.");
    // there are 3 states. READER/WRITER/ALL
    if (e.getState() == IdleState.ALL_IDLE) {
      int statusCodeInt = 1;
      String statusCode = statusCodeInt + " FAILURE";
      String errMsg = "UDP idle (read) timeout";
      udpWorker.onComplete(udpWorker.responseSb.toString(), true,
          errMsg, errMsg, statusCode, statusCodeInt);
    }
  }
}
origin: os-libera/OpenVirteX

@Override
public void channelIdle(final ChannelHandlerContext ctx,
    final IdleStateEvent e) throws Exception {
  final OFMessage m = BasicFactory.getInstance().getMessage(
      OFType.ECHO_REQUEST);
  e.getChannel().write(Collections.singletonList(m));
}
origin: org.apache.hadoop/hadoop-mapreduce-client-shuffle

 @Override
 public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
  if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) {
   e.getChannel().close();
  }
 }
}
origin: org.onosproject/onos-pcep-controller-impl

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception {
  if (!isHandshakeComplete()) {
    return;
  }
  if (e.getState() == IdleState.READER_IDLE) {
    // When no message is received on channel for read timeout, then close
    // the channel
    log.info("Disconnecting client {} due to read timeout", getClientInfoString());
    ctx.getChannel().close();
  } else if (e.getState() == IdleState.WRITER_IDLE) {
    // Send keep alive message
    log.debug("Sending keep alive message due to IdleState timeout " + pc.toString());
    pc.sendMessage(Collections.singletonList(pc.factory().buildKeepaliveMsg().build()));
  }
}
origin: com.github.jiayuhan-it/hadoop-nfs

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
  throws Exception {
 if (e.getState() == IdleState.ALL_IDLE) {
  e.getChannel().close();
 }
}
origin: org.onosproject/onos-protocols-pcep-ctl

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception {
  if (!isHandshakeComplete()) {
    return;
  }
  if (e.getState() == IdleState.READER_IDLE) {
    // When no message is received on channel for read timeout, then close
    // the channel
    log.info("Disconnecting client {} due to read timeout", getClientInfoString());
    ctx.getChannel().close();
  } else if (e.getState() == IdleState.WRITER_IDLE) {
    // Send keep alive message
    log.debug("Sending keep alive message due to IdleState timeout " + pc.toString());
    pc.sendMessage(Collections.singletonList(pc.factory().buildKeepaliveMsg().build()));
  }
}
origin: org.apache.hive/hive-llap-server

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

@Override
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception {
  // check if the client did nothing for too long
  if (e.getState().equals(IdleState.ALL_IDLE)) {
    ImapSession session = (ImapSession) attributes.get(ctx.getChannel());
    InetSocketAddress address = (InetSocketAddress) ctx.getChannel().getRemoteAddress();
    LOGGER.info("Logout client {} ({}) because it idled for too long...",
      address.getHostName(),
      address.getAddress().getHostAddress());
    // logout the client
    session.logout();
    // close the channel
    ctx.getChannel().close();
  }
  
  super.channelIdle(ctx, e);

}
origin: org.hbase/asynchbase

 @Override
 public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
     throws Exception {
  if (e.getState() == IdleState.ALL_IDLE) {
   idle_connections_closed.increment();
   LOG.info("Closing idle connection to HBase region server: " 
     + e.getChannel());
   // RegionClientPipeline's disconnect method will handle cleaning up
   // any outstanding RPCs and removing the client from caches
   try {
    e.getChannel().close();
   } catch (Exception ex) {
    // This handler may be called after a channel has entered an odd state
    // or already been closed. If it has been closed properly, then ignore
    // the exception, otherwise throw it.
    if (!(ex instanceof ClosedChannelException)) {
     throw ex;
    }
   }
  }
 }
}
origin: wangscu/jessica

  public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception
  {
    // just close idle connection
    if (e.getState() == IdleState.ALL_IDLE)
    {
      ChannelFuture future = ctx.getChannel().close();
      future = future.await();
      if (future.isSuccess())
      {
        log.info("close idle connecton: client ip=>" + ctx.getChannel().getRemoteAddress());
      } else
      {
        log.info("failure close idle connecton: client ip=>" + ctx.getChannel().getRemoteAddress());

      }
    }
  }
}
org.jboss.netty.handler.timeoutIdleStateEvent

Javadoc

A ChannelEvent that is triggered when a Channel has been idle for a while.

Most used methods

  • getState
    Returns the detailed idle state.
  • getChannel
  • getLastActivityTimeMillis
    Returns the last time when I/O occurred in milliseconds.

Popular in Java

  • Start an intent from android
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (Timer)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • 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