Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6899753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:27:41+00:00 2026-05-27T07:27:41+00:00

In Netty, does anyone know if the ChannelBuffer passed to a handler for an

  • 0

In Netty, does anyone know if the ChannelBuffer passed to a handler for an upstream event (after you cast it from ChannelEvent / or MessageEvent) will be concurrently written to by the Netty framework while you process it?

The user guide and examples do not explicitly clarify whether this will happen or not.

For example, imagine the method below in a class that extends SimpleChannelHandler and is bound as the handler on a netty server:

@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
{
  ChannelBuffer buffer = (ChannelBuffer) e.getMessage();

  if (buffer.readableBytes() == 4)
  {
    // Is it possible for the number of readable bytes to increase here?
  }
}

In the above method, is it possible for the number of readable bytes to increase on the commented line (assuming the client is still sending data), or will those frames be guaranteed to be separate messages and not written into the supplied buffer?

The reason I ask is to know whether or not I should copy the buffer to a local one before doing some of my processing, or whether such a copy is superfluous.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:27:41+00:00Added an answer on May 27, 2026 at 7:27 am

    Once Netty creates a ChannelBuffer and triggers a MessageEvent with it, it’s out of Netty’s hands and thus Netty does not modify it by any means. The handlers or other user code can modify the buffer, but usually, well written handlers do not interfere with other handlers. If a bad handler keeps the reference to the received buffer and modifies later, then you will see broken buffer state though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does netty have built-in support for this somehow? If it doesn't have, where should
Netty defines two methods for channels: isOpen() and isConnected(), but the Javadoc does not
I know that HornetQ offers Netty SSL Transport A Role Based Security Model My
I have server application based on Netty. It decode message (from json) and send
Is it possible for Netty to create a worker thread that does all the
The following is isEmpty() method from ConcurrentWeakKeyHashMap.java, https://github.com/netty/netty/blob/master/src/main/java/org/jboss/netty/util/internal/ConcurrentWeakKeyHashMap.java Why does it need mcsum, and
Has anyone made a Servlet API implementation built on top of Netty? I'm tempted
Websocket example in netty (examples) has a http request handler which: performs hand shaking
I have a written a very simple UDP Server using Netty - it quite
Do you know a simple script to count NLOCs (netto lines of code). The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.