activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clebert Suconic <clebert.suco...@gmail.com>
Subject Re: [DISCUSS] Replacing Executor by a new Actor on ServerSessionHandler
Date Mon, 10 Jul 2017 23:30:21 GMT
Also: I need some help with this.


Actor is defined as Actor<T>


Does anyone know a way to define a method similar to this:


SomeFactory:
  Actor<T> newActor(T type)


That is, type of Actor is passed in as argument. This is because I
would like OrderedExecutorFactory to include the new Actor method, and
I couldn't figure out how to do this through a factory.

On Mon, Jul 10, 2017 at 7:26 PM, Clebert Suconic
<clebert.suconic@gmail.com> wrote:
> I am replacing the use of an executor on ServerSessionHandler by a new
> class I just wrote (after some deep technical discussion with
> Francesco, to give him the credits)..
>
> ServerSessionHandler is currently creating a new Runnable on every
> call made through the PacketHandler...
>
> this is because:
>
> of this method:
>
>   @Override
>    public void handlePacket(final Packet packet) {
>       channel.confirm(packet);
>       callExecutor.execute(() -> internalHandlePacket(packet));
>    }
>
>
>
> The new Actor class is similar to an executor, but it varies on the following:
>
> Instead of receiving a Runnable, it receives an argument (or message)
> that is then sent to a listener method:
>
>
> The implementation gets a lot clearer:
>
>
> @Override
> public void handlePacket(final Packet packet) {
>    channel.confirm(packet);
>
>    // This method will call onMessagePacket through an actor
>    packetActor.sendMessage(packet);
> }
>
>
>
> And the method is just called without a new Runnable.
>
>
>
> Here's the PR: https://github.com/apache/activemq-artemis/pull/1395
>
>
>
>
> --
> Clebert Suconic



-- 
Clebert Suconic

Mime
View raw message