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 7019929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:15:04+00:00 2026-05-27T23:15:04+00:00

I have a typical netty server setup just a bit confused on the proper

  • 0

I have a typical netty server setup just a bit confused on the “proper” way to implement or rather add an OrderedMemoryAwareThreadPoolExecutor to a pipelinefactory for specific types of requests. For most requests the typical NIO request/response is fine. However for a specific type of request I’d like to use traditional threaded I/O (ala OMATPE) because of the potential for it being a long running request. What I’m doing now is parsing the URI to get the specific type of request. Short requests will be processed normally and requests of type “/long/running/request” I continue to send upstream which passes through an OMATPE which is then passed to an appropriate handler. Is this the way to go? The pipeline looks something like the following:

 public ChannelPipeline getPipeline() {
     return Channels.pipeline(
             new HttpMessageEncoder(),
             new HttpMessageDecoder(),
             new shortLivedRequestHandler(),
             executionHandler,
             new longLivedRequestHandler());
 }

In the ‘shortLivedRequestHandler’ those URI’s matching a “short-lived” regex will be processed and then sent downstream. If those URI’s happend to match a “long-lived” regex then we pass upstream to the “longLivedRequestHandler” which will in theory process in a non-blocking I/O thread and send response downstream when done.

  • 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-27T23:15:04+00:00Added an answer on May 27, 2026 at 11:15 pm

    You can try not using OMATPE and manually configuring and using your own ThreadPool.

    // Stored as a private field in your pipeline and passed into the constructor of your handler
    Executor executor = Executors.newFixedThreadPool(16); 
    
    // In your handler
    public class MyRequestHandler extends SimpleChannelUpstreamHandler {
        private Executor _executor = null;
    
        public MyRequestHandler (Executor executor) {
            _executor = executor;
        }
    
        public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
            if (requestThatUseThreadPool) {
                _executor.execute(new Runnable() {
                    @Override
                    public void run() {
                       // Do some work in another thread
                       HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK);
                       res.setContent(ChannelBuffers.copiedBuffer("hello".toString(), UTF_8_CHARSET));
                       ChannelFuture f = ctx.getChannel().write(res);
                    }
                });
            } else {
                // Do some work in this thread
                HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK);
                res.setContent(ChannelBuffers.copiedBuffer("hello".toString(), UTF_8_CHARSET));
                ChannelFuture f = ctx.getChannel().write(res);
            }
        }
    }
    

    Hope this helps.

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

Sidebar

Related Questions

I have a typical server in my end and a friend using a client
I have a typical SQL Server hierarchical query: WITH bhp AS ( SELECT name,
I have a typical CRUD app, I would like to add a link next
I have a typical model setup: Store has_many Items Orders has_many Items :through OrderItems
We have 5mb of typical text (just plain words). We have 1000 words/phrases to
I have typical parent and child categories setup as follows: Food potatoes corn beats
I have a typical MVVM setup of Listbox and vm + DataTemplate and item
I have a typical setup for displaying charts for MVC3 web page - Here
We have a typical business application with an Outlook-looking Winforms client talking to asmx
I have this typical scenario. I have a smartclient application built on .net 2.0

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.