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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:09:44+00:00 2026-05-27T03:09:44+00:00

I am working on designing trade system using Java Realtime ( Sun JRTS 2.2

  • 0

I am working on designing trade system using Java Realtime ( Sun JRTS 2.2 ) and would like to few questions about best practices, because I am afraid of inventing the wheel and pretty sure that my task was already solved.

So I have thread that continuously reading the socket, parsing bytes and extracting messages (binary protocol ). Afterwards, I should send messages to the algorithm, that actually does some calculation and make decision to trade or not.

So I think the way I should design this system is to split it into 2 parts. Producer ( periodic(?) Realtime thread that extracts bytes from socket, parse it ) and Consumer ( Realtime thread (periodic/sporadic?) that extracts messages from producer, manipulates with them etc ).

So the first question is how to design high performance communication between these 2 threads ( producer/consumer )? Also I would love to hear the comments about the existing experience in designing such systems, advices and etc.

Thank you for your help!

  • 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-27T03:09:45+00:00Added an answer on May 27, 2026 at 3:09 am

    I am working with a similar problem but in a different domain:

    Here is how I dealt with that:

    public class Producer extends Thread{
       private BlockingQueue<E> consumerQueue = null;
       public setConsumerQueue(BlockingQueue<E> val){
          consumerQueue = val;
       }
       // main method where data is received from socket...
       public void run(){
          while(!interrupted()){
               data = socket.receive();// Receive data
               if(consumerQueue!=null) consumerQueue.offer(data);
          }
       }
    }
    
    public class Consumer extends Thread{
       private BlockingQueue<E> consumerQueue = new BlockingQueue<E>();
       public Consumer (Producer val){
          val.setConsumerQueue(consumerQueue);
       }
       public void run(){
          while(!interrupted()){
               data = consumerQueue.take();// block until there is data from producer
               if(data !=null) processData(data);
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on designing my first FPS game using JOGL. (Java bindings
I am working on designing a small system and am wondering about a nuance
We are working on designing an application that is typically OLTP (think: purchasing system).
I am working on designing and building a desktop application. I am thinking about
I'm working on designing a multi-tiered app in Perl and I'm wondering about the
I am working on designing an Android application, and I have several questions I
I am working on a networking program and designing a Linux server using C++.
I am working on designing a user profile web page in asp.net using c#.
I'm working on a project with designing a core data system for searching and
I have been working on Flash AS3 project. I am designing a 3D system.

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.