how to do actors (erlang) in java? -
I work on financial applications in Java and getting concurrency is just pain, Eirlang and actor model are mass concurrently It is considered a good fit for applications but I can not understand how to do it in Java. I know that there are libraries like Jathlong, Functional Java, Kilim etc. But they generally do not go beyond simplified examples.
Say I need a process of three or four different incidents, like counting some numbers, market data feeds, order / business feeds, and some derivative 'outputing' of this data. Most of the time, the streams of these events or data are required to be processed in sequence (in relation to at least some key ... for example, all orders of a particular symbol are processed in order, but unrelated in parallel In relation to the symbols)
I create a general Java object with those methods which change the state, instead of changing the state directly to the state, Meters (by converting them to a command object) into FIFO Qi (Arling's mailbox) and added a response () method that performs the queue process. In this way, all updates will have to go through one line and the response () method can be transmitted to one update at a time. Theoretically it will save me from the need to lock or synchronize this method.
However, this queue is originally a creator / consumer line, which means that it is a blocked queue. Blocking for scalability is bad too, besides being a single queue means that all of my updated command objects (different types) come out of the queue, like some objects are super objects (like objects) Insert and Respond () Process them.
Once this actor produces an output, another item is consumed by it, then I go through the same process. In other words, I have changed the programming model from object-oriented, with those methods that return the results, any kind of continuity passes through the nightmare, where all my methods are asynchronous.
Any ideas how can I reach it?
Comments
Post a Comment