Relative Content

Tag Archive for asynchronous-programming

Why would Java app make RPC call to itself?

I am working with a multithreaded homegrown multi-module app in my new job. We use the the Thrift protocol to communicate RPC calls between different stand-alone applications in a distributed system. One of them listens on multiple ports and I just noticed that it actually makes an RPC call to itself from one thread invoked from one socket it listens to (web service call) to another port within the same app. I verified that it could accomplish the same thing if it just went and directly called the method that the remote procedure ultimately invokes as it is all within the same application, same JVM. To make it even more mysterious, the call is completely synchronous, i.e. no callbacks involved. The first thread totally sits and waits until it makes a call across the wire to itself and comes back.

Not await an asynchronous method because it is like an endless loop – good practice?

I inherited a piece of software. This program is connected to an external hardware, which is a measurement device. Every 100 milliseconds, a value is read from this device and displayed to the user. When the user clicks a button, this continuous measurement is interrupted and no value will be displayed to the user anymore. Some action is done and when this action is finished, the program starts to take the measurement values again. In the code, this realized like this:

How is async implemented natively?

How is async logic implemented natively without threads? What would be the high level structure of the system?
Is it just a separate OS thread that gets and pushes requests and results in 2 queues?
I keep reading about a state machine and event loop when implementing async but I’m not quite sure about the general structure.

How is async implemented natively?

How is async logic implemented natively without threads? What would be the high level structure of the system?
Is it just a separate OS thread that gets and pushes requests and results in 2 queues?
I keep reading about a state machine and event loop when implementing async but I’m not quite sure about the general structure.