Package asia.stampy.common.gateway

Examples of asia.stampy.common.gateway.HostPort


   */
  @Override
  protected void ensureCleanup() {
    getGateway().addHandler(new SimpleChannelUpstreamHandler() {
      public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        HostPort hostPort = new HostPort((InetSocketAddress) ctx.getChannel().getRemoteAddress());
        if (loggedInConnections.contains(hostPort)) {
          log.debug("{} session terminated before DISCONNECT message received, cleaning up", hostPort);
          loggedInConnections.remove(hostPort);
        }
      }
View Full Code Here


   * org.jboss.netty.channel.SimpleChannelUpstreamHandler#messageReceived(org
   * .jboss.netty.channel.ChannelHandlerContext,
   * org.jboss.netty.channel.MessageEvent)
   */
  public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    final HostPort hostPort = createHostPort(ctx);
    log.debug("Received raw message {} from {}", e.getMessage(), hostPort);

    helper.resetHeartbeat(hostPort);

    if (!helper.isValidObject(e.getMessage())) {
View Full Code Here

   * @param ctx
   *          the ctx
   * @return the host port
   */
  protected HostPort createHostPort(ChannelHandlerContext ctx) {
    return new HostPort((InetSocketAddress) ctx.getChannel().getRemoteAddress());
  }
View Full Code Here

   *          the e
   * @throws Exception
   *           the exception
   */
  public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    HostPort hostPort = createHostPort(ctx);
    sessions.put(hostPort, ctx.getChannel());
    ctx.sendUpstream(e);
  }
View Full Code Here

   *          the e
   * @throws Exception
   *           the exception
   */
  public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    HostPort hostPort = createHostPort(ctx);
    sessions.remove(hostPort);
    ctx.sendUpstream(e);
  }
View Full Code Here

    if (channel == null || !channel.isConnected()) {
      log.error("Channel is not connected, cannot send message {}", message);
      return;
    }

    if (hostPort == null) hostPort = new HostPort((InetSocketAddress) channel.getRemoteAddress());
    helper.resetHeartbeat(hostPort);

    channel.write(message);
  }
View Full Code Here

   * org.jboss.netty.channel.SimpleChannelUpstreamHandler#exceptionCaught(org
   * .jboss.netty.channel.ChannelHandlerContext,
   * org.jboss.netty.channel.ExceptionEvent)
   */
  public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
    HostPort hostPort = createHostPort(ctx);
    log.error("Unexpected Netty exception for " + hostPort, e.getCause());
  }
View Full Code Here

   */
  @Override
  protected void ensureCleanup() {
    getGateway().addHandler(new SimpleChannelUpstreamHandler() {
      public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        HostPort hostPort = new HostPort((InetSocketAddress) ctx.getChannel().getRemoteAddress());
        if (connectedClients.contains(hostPort)) {
          log.debug("{} session terminated with outstanding connection, cleaning up", hostPort);
          connectedClients.remove(hostPort);
        }
      }
View Full Code Here

   */
  @Override
  protected void ensureCleanup() {
    getGateway().addHandler(new SimpleChannelUpstreamHandler() {
      public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        HostPort hostPort = new HostPort((InetSocketAddress) ctx.getChannel().getRemoteAddress());
        if (activeTransactions.containsKey(hostPort)) {
          log.debug("{} session terminated with outstanding transaction, cleaning up", hostPort);
          activeTransactions.remove(hostPort);
        }
      }
View Full Code Here

   */
  @Override
  protected void ensureCleanup() {
    getGateway().addHandler(new SimpleChannelUpstreamHandler() {
      public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
        HostPort hostPort = new HostPort((InetSocketAddress) ctx.getChannel().getRemoteAddress());
        if (messages.containsKey(hostPort)) {
          log.debug("{} session terminated, cleaning up message interceptor", hostPort);
          messages.remove(hostPort);
        }
      }
View Full Code Here

TOP

Related Classes of asia.stampy.common.gateway.HostPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.