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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:06:49+00:00 2026-05-23T12:06:49+00:00

I am using protobuf for implementing a communication protocol between a Java application and

  • 0

I am using protobuf for implementing a communication protocol between a Java application and a native application written in C++. The messages are event driven: when an event occurs in the C++ application a protobuf message is conructed and sent.

message MyInterProcessMessage {

   int32 id = 1;

   message EventA { ... }
   message EventB { ... }
   ...
}

In Java I receive on my socket an object of the class: MyInterProcessMessageProto. From this I can get my data very easily since they are encapsulated into each other: myMessage.getEventA().getName();

I am facing two problems:

  1. How to delegate the processing of the received messages?

    Because, analysising the whole message and distinguishing the different event types and the actions they imply resulted in a huge and not maintainable method with many if-cases.

  2. I would like to find a pattern, where I can preserve the messages and not only apply them, but also undo them, like the Command pattern is used to implement this.

My first approach would be: create different wrapper classes for each event with a specified apply() and undo() method and delegate the job this way.

However I am not sure if this is the right way or whether there are not any better solutions.


To clarify my application:

The Java application models a running Java Virtual Machine and holds information, for instance Threads, Monitors, Memory, etc.

Every event changes the current state of the modeled JVM. For instance, a new thread was launched, another thread goes into blocking state, memory was freed etc. In the same meaning the events are modeled: ThreadEvent, MemoryEvent, etc.

This means, the messages have to be processed sequentially. In order to iterate back to previous states of the JVM, I would like to implement this undo functionality.

For undo I already tried. clearAllStates, apply Events until Event #i.

Unfortunately with 20.000+ events this is total inefficient.

  • 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-23T12:06:49+00:00Added an answer on May 23, 2026 at 12:06 pm

    To provide a tailored answer it would be good to know what you’re doing with received messages, if they can be processed concurrently or not, and how an undo impacts the processing of messages received after and undo‘ed message.

    However, here’s a generic suggestion: A typical approach is to delegate received messages to a queue-like handler class, which usually runs in an own thread (to let the message receiver get ready for the next incoming message as soon as possible) and sequentially processes received messages. You could use a stack-like class to keep track of processed messages for the sake of the undo feature. You could also use specific queues and stacks for different event types.

    Basically this resembles the thread pool pattern.

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

Sidebar

Related Questions

I have started using the protobuf-net lib to communication between some of the programs
We are using protobuf-net for serialization and deserialization of messages in an application whose
We have been successfully using protobuf-net v1 in a compact framework application to handle
We are looking at using Google's Protocol Buffers to handle serialization between a c++
I'm writing a system that has a set of protocol buffers (using protobuf-net), I
I am using protobuf-net in my .net project to use protocol buffer. The project
I'm using protobuf-net r278 in C#, and I just noticed that if I have
I'm having issues deserializing certain Guid properties of ORM-generated entities using protobuf-net. Here's a
I am using the latest version of protobuf-net with VS2008 integration. I have created
I'm using Protobuf-net. Suppose I have a list of Gizmo objects serialized and 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.