Codota Logo
Channel.attr
Code IndexAdd Codota to your IDE (free)

How to use
attr
method
in
io.netty.channel.Channel

Best Java code snippets using io.netty.channel.Channel.attr (Showing top 20 results out of 1,602)

Refine searchRefine arrow

  • Attribute.set
  • ChannelHandlerContext.channel
  • Attribute.get
  • Common ways to obtain Channel
private void myMethod () {
Channel c =
  • Codota IconChannelFuture future;future.channel()
  • Codota IconChannelHandlerContext ctx;ctx.channel()
  • Codota IconChannelHandlerContext ctx;ctx.channel().read()
  • Smart code suggestions by Codota
}
origin: netty/netty

@Override
public <T> Attribute<T> attr(AttributeKey<T> key) {
  return ctx.channel().attr(key);
}
origin: Netflix/zuul

  protected void copyAttrFromParentChannel(Channel parent, Channel child, AttributeKey key)
  {
    child.attr(key).set(parent.attr(key).get());
  }
}
origin: redisson/redisson

public CommandData getCurrentCommand() {
  QueueCommand command = channel.attr(CommandsQueue.CURRENT_COMMAND).get();
  if (command instanceof CommandData) {
    return (CommandData)command;
  }
  return null;
}
origin: Netflix/zuul

private void incrementCurrentRequestsInFlight(ChannelHandlerContext ctx)
{
  currentRequestsGauge.set(currentRequests.incrementAndGet());
  ctx.channel().attr(ATTR_REQ_INFLIGHT).set(INFLIGHT);
}
origin: netty/netty

  @Override
  public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception {
    Attribute<Unmarshaller> attr = ctx.channel().attr(UNMARSHALLER);
    Unmarshaller unmarshaller = attr.get();
    if (unmarshaller == null) {
      unmarshaller = super.getUnmarshaller(ctx);
      attr.set(unmarshaller);
    }
    return unmarshaller;
  }
}
origin: redisson/redisson

protected static boolean isHandlerActive(ChannelHandlerContext ctx) {
  Boolean suspended = ctx.channel().attr(READ_SUSPENDED).get();
  return suspended == null || Boolean.FALSE.equals(suspended);
}
origin: Netflix/zuul

  public static void setForChannel(Channel ch, ConnectionCloseType type)
  {
    ch.attr(ATTR_CLOSE_TYPE).set(type);
  }
}
origin: Netflix/zuul

  private void decrementCurrentRequestsIfOneInflight(ChannelHandlerContext ctx)
  {
    if (ctx.channel().attr(ATTR_REQ_INFLIGHT).getAndRemove() != null) {
      currentRequestsGauge.set(currentRequests.decrementAndGet());
    }
  }
}
origin: apache/zookeeper

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  LOG.warn("Exception caught", cause);
  NettyServerCnxn cnxn = ctx.channel().attr(CONNECTION_ATTRIBUTE).getAndSet(null);
  if (cnxn != null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Closing {}", cnxn);
    }
    cnxn.close();
  }
}
origin: Netflix/zuul

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception
{
  // Store a ref to the count of current inflight requests onto this channel. So that
  // other code can query it using getInflightRequestCountFromChannel().
  ctx.channel().attr(ATTR_CURRENT_REQS).set(currentRequests);
  super.channelActive(ctx);
}
origin: redisson/redisson

  @Override
  public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception {
    Attribute<Unmarshaller> attr = ctx.channel().attr(UNMARSHALLER);
    Unmarshaller unmarshaller = attr.get();
    if (unmarshaller == null) {
      unmarshaller = super.getUnmarshaller(ctx);
      attr.set(unmarshaller);
    }
    return unmarshaller;
  }
}
origin: eclipse-vertx/vert.x

public String indicatedServerName() {
 if (chctx.channel().hasAttr(SslHandshakeCompletionHandler.SERVER_NAME_ATTR)) {
  return chctx.channel().attr(SslHandshakeCompletionHandler.SERVER_NAME_ATTR).get();
 } else {
  return null;
 }
}
origin: redisson/redisson

public CommandData getCurrentCommand() {
  QueueCommand command = channel.attr(CommandsQueue.CURRENT_COMMAND).get();
  if (command instanceof CommandData) {
    return (CommandData)command;
  }
  return null;
}
origin: neo4j/neo4j

@Override
public void uninstall( Channel channel )
{
  channel.attr( LOCK_KEY ).set( null );
}
origin: Netflix/zuul

  private void decrementCurrentRequestsIfOneInflight(ChannelHandlerContext ctx)
  {
    if (ctx.channel().attr(ATTR_REQ_INFLIGHT).getAndRemove() != null) {
      groupMetrics.getForCurrentEventLoop().decrementCurrentRequests();
    }
  }
}
origin: eclipse-vertx/vert.x

 @Override
 public <T> Attribute<T> attr(AttributeKey<T> key) {
  return ctx.channel().attr(key);
 }
}
origin: apache/zookeeper

@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  if (LOG.isTraceEnabled()) {
    LOG.trace("Channel inactive {}", ctx.channel());
  }
  allChannels.remove(ctx.channel());
  NettyServerCnxn cnxn = ctx.channel().attr(CONNECTION_ATTRIBUTE).getAndSet(null);
  if (cnxn != null) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Channel inactive caused close {}", cnxn);
    }
    cnxn.close();
  }
}
origin: Netflix/zuul

  protected void copyAttrFromParentChannel(Channel parent, Channel child, AttributeKey key)
  {
    child.attr(key).set(parent.attr(key).get());
  }
}
origin: Netflix/zuul

  @Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
  {
    try {
      super.userEventTriggered(ctx, evt);
    }
    finally {
      if (evt instanceof HttpLifecycleChannelHandler.CompleteEvent) {
        ctx.channel().attr(ATTR_STATE).set(null);
      }
    }
  }
}
origin: Netflix/zuul

protected static boolean fireCompleteEventIfNotAlready(ChannelHandlerContext ctx, CompleteReason reason)
{
  // Only allow this method to run once per request.
  Attribute<State> attr = ctx.channel().attr(ATTR_STATE);
  State state = attr.get();
  if (state == null || state != State.STARTED)
    return false;
  
  attr.set(State.COMPLETED);
  HttpRequest request = ctx.channel().attr(ATTR_HTTP_REQ).get();
  HttpResponse response = ctx.channel().attr(ATTR_HTTP_RESP).get();
  // Cleanup channel attributes.
  ctx.channel().attr(ATTR_HTTP_REQ).set(null);
  ctx.channel().attr(ATTR_HTTP_RESP).set(null);
  // Fire the event to whole pipeline.
  ctx.pipeline().fireUserEventTriggered(new CompleteEvent(reason, request, response));
  
  return true;
}
io.netty.channelChannelattr

Popular methods of Channel

  • writeAndFlush
  • close
  • remoteAddress
    Returns the remote address where this channel is connected to. The returned SocketAddress is suppose
  • pipeline
    Return the assigned ChannelPipeline.
  • closeFuture
    Returns the ChannelFuture which will be notified when this channel is closed. This method always ret
  • isActive
    Return true if the Channel is active and so connected.
  • localAddress
    Returns the local address where this channel is bound to. The returned SocketAddress is supposed to
  • eventLoop
    Return the EventLoop this Channel was registered to.
  • isOpen
    Returns true if the Channel is open and may get active later
  • write
  • alloc
    Return the assigned ByteBufAllocator which will be used to allocate ByteBufs.
  • isWritable
    Returns true if and only if the I/O thread will perform the requested write operation immediately. A
  • alloc,
  • isWritable,
  • config,
  • flush,
  • newPromise,
  • id,
  • read,
  • voidPromise,
  • isRegistered

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JCheckBox (javax.swing)
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now