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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:59:00+00:00 2026-05-31T13:59:00+00:00

Within my JavaEE web application, I need to process incoming messages strictly in the

  • 0

Within my JavaEE web application, I need to process incoming messages strictly in the order of arrival. I assume that my webapp container (Tomcat 6) retains the order of messages as they arrive at the http port.

What causes headaches to me, is the way I am internally processing these messages. For improved workload, I append the processing of each message to a ThreadPool as many things need to be done here e.g. XML parsing, sometimes enrichment of data using external web services. After processing is finished, I push the java representation of the message into a complex stream processing engine esper.codehaus.org, which is threadsafe. Here, different patterns are checked where the entrance order is the highest requirement e.g threshold of a phenomenon exceeds.

I had the idea of inserting every processed message into a PriorityQueue with a priority ID they received at time of arrival (in my Servlet, where it is incremented for each message). The problem is the following:

The thread which is polling the elements from the queue (lowest ID is the head of the queue) for inserting it into esper could skip an ID as it does not check for missing items. I guess an illustration works out better:

enter image description here

For steps (1) to (4) everything works as intended. But at step (5) the QueuePoller retrieves element 6 and not element 4 (which is later inserted at step (6)). This results in the message order: 2; 3; 6; 4.

What I tried to do was to alter the implementation of polling the queue’s head to follow the strict order of IDs. Meaning, if the next ID’s element is not yet inserted into the queue, wait at a barrier until its there. This seemed to work for the first 10 minutes but then hanged, probably due to an element that never got inserted into the queue.

Anyone out there having a similar problem in the past and has some hint for me?

  • 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-31T13:59:01+00:00Added an answer on May 31, 2026 at 1:59 pm

    Check out Disruptor — a high performance queue with strict order (first enter — first served)

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

Sidebar

Related Questions

I have a JavaEE application that needs to access a file in order to
I'm trying to make a web page that only has content within the page
I currently have a Maven application within Netbeans. Since I need to use regular
Within my application I would like to show a web page within a view
Within an application, I've got Secret Keys uses to calculate a hash for an
Within Ruby on Rails applications database.yml is a plain text file that stores database
Within c#, I need to be able to Connect to a remote system, specifying
Within my Subversion project I have a few directories that contain other open source
Within an n-tier app that makes use of a WCF service to interact with
Within the context of C# on .Net 4.0, are there any built-in objects that

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.