Re: Loopback messages

2019-02-14 Thread Jonathan Valliere
Is all of this conversation just to avoid using a lock? The simplest thing to synchronize the non io processor with an external thread would to use a lock. On Thu, Feb 14, 2019 at 1:07 PM Emmanuel Lécharny wrote: > > On 14/02/2019 17:28, kevintjuh93 wrote: > > Yes, I am aware that's what

Re: Loopback messages

2019-02-14 Thread Emmanuel Lécharny
On 14/02/2019 17:28, kevintjuh93 wrote: Yes, I am aware that's what happens. And in these cases I can make it execute at the end of a messageReceived. But my case is that I do something from a non io-processor thread, but what it does needs to be synced with the io-processor. Ok, now that

Re: Loopback messages

2019-02-14 Thread Emmanuel Lécharny
On 14/02/2019 17:42, Jonathan Valliere wrote: On a side note, this is the developers mailing list. We're filling the inboxes of other developers that probably don't want to be a part of this conversation. We should move it to the us...@mina.apache.org mailing list. True. Although I

Re: Loopback messages

2019-02-14 Thread Jonathan Valliere
On a side note, this is the developers mailing list. We're filling the inboxes of other developers that probably don't want to be a part of this conversation. We should move it to the us...@mina.apache.org mailing list. On Thu, Feb 14, 2019 at 11:36 AM Jonathan Valliere wrote: > so I cannot

Re: Loopback messages

2019-02-14 Thread kevintjuh93
Yes, I am aware that's what happens. And in these cases I can make it execute at the end of a messageReceived. But my case is that I do something from a non io-processor thread, but what it does needs to be synced with the io-processor. Emmanuel Lécharny wrote > Let's be clear: > > - reads will

Re: Loopback messages

2019-02-14 Thread Jonathan Valliere
> > so I cannot ensure a message is being received/sent and look at some queue > for this. Why do you need to ensure the message is sent? Once you call write(), it will be sent eventually. The only guarantee that it was actually sent and received would to require the Client to reply to the

Re: Loopback messages

2019-02-14 Thread Emmanuel Lécharny
Let's be clear: - reads will result in a messageReceived event and you will be able to process it and do whatever you want to do in your IoHandler, as soon as the message is complete (ie, if the message is read in chunks, you will only receive a messageReceived event once the message is

Re: Loopback messages

2019-02-14 Thread kevintjuh93
It's for a game server where actions need to be synchronized with read/write in order to make sure everything is done in order. Not everything is executed from read/write methods, so I cannot ensure a message is being received/sent and look at some queue for this. That's why I want to execute

Re: Loopback messages

2019-02-14 Thread Jonathan Valliere
I just read the last email Kevin wrote. Kevin, if you could execute something on the IO processor thread; you understand that It would be a deferred action that could only happen after the IO processor is done? Maybe you could explain the reason why you want to do this? On Thu, Feb 14, 2019 at

Re: Loopback messages

2019-02-14 Thread Emmanuel Lécharny
I still don't get it. Your IoHandler will be called everytime an event occurs (message received, message written, session created/closed/idling, exception). You have the opportunity to execute some action at this moment. Beside that, I don't see a use case. I'm probably missing something...

Re: Loopback messages

2019-02-14 Thread Jonathan Valliere
There are some examples in the unit tests which accomplish this by creating a Client and Server connection. I don't believe there is a true loopback implementation in Mina without going through the OS networking. On Thu, Feb 14, 2019 at 10:16 AM kevintjuh93 wrote: > Hi guys, > > What I mean is

Re: Loopback messages

2019-02-14 Thread kevintjuh93
Hi guys, What I mean is that I want a way to execute something for an IoSession in the same thread the I/O events run. I figured a good way would be to 'fake' an incoming message, called a loopback packet. Like write a message to 'yourself'. I rather like to avoid using an ExecutorFilter or a

Re: Loopback messages

2019-02-14 Thread kevintjuh93
What I mean is to send a loopback message. This means I want to write a message to the session that's sending the message. But the reason I want to do this, is because I need to execute something synchronized with the I/O events (read/write). -- Sent from:

Re: Loopback messages

2019-02-08 Thread Emmanuel Lécharny
On 08/02/2019 15:22, Jonathan Valliere wrote: You mean that you want to pass messages from one thread to another? Or from one session to another one ? On Fri, Feb 8, 2019 at 9:02 AM Kevin Kal wrote: Dear Sir/Madam, I've been trying to find out how to send loopback messages

Re: Loopback messages

2019-02-08 Thread Emmanuel Lécharny
On 08/02/2019 15:22, Jonathan Valliere wrote: You mean that you want to pass messages from one thread to another? Or from one session to another one ? On Fri, Feb 8, 2019 at 9:02 AM Kevin Kal wrote: Dear Sir/Madam, I've been trying to find out how to send loopback messages

Re: Loopback messages

2019-02-08 Thread Jonathan Valliere
You mean that you want to pass messages from one thread to another? On Fri, Feb 8, 2019 at 9:02 AM Kevin Kal wrote: > Dear Sir/Madam, > > I've been trying to find out how to send loopback messages on a IoSession, > but I can't seem to figure this out. > > My situation is

Loopback messages

2019-02-08 Thread Kevin Kal
Dear Sir/Madam, I've been trying to find out how to send loopback messages on a IoSession, but I can't seem to figure this out. My situation is as follows: I am making a Game Server with NioSocketAcceptor. Each incoming connection is saved and every actually works fine. BUT, I need a way