You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by tiandike <wh...@21cn.com> on 2007/11/15 05:59:40 UTC

Re: How to implement the synchronized function call?

In my project I implement a synclient , to guarantee the response 
correspondence with  request  ,the response and request must has a field
messageID .

I use Map and BlockingQueue  in the DefaultConnectionImpl.java

you can write your code like:
ConnectionFactory cf = new DefaultConnectionFactoryImpl();
Connection co = cf.createConnection("localhost",1234);

YourRequest request = new YourRequest ()
request.setMessageID(1)

object res = co.sendandreceive(request);

in your mina server your must get the requestid and put this id in response.
http://www.nabble.com/file/p13761128/syclient.rar syclient.rar 


tiandike wrote:
> 
> I want to implement a interface  like   User  getuser(String id);
> 
> My ClientApp use getuser  function to get user from ServerApp, 
> 
> the client use IoSession.write function to send message from client to
> Server, and Server's handler receive message and 
> IoSession.write  the user object, then the client handler messageReceived
> function called. this is asynchronized.
> 
> how can i implement the synchronized function call on mina?
> 

-- 
View this message in context: http://www.nabble.com/How-to-implement-the-synchronized-function-call--tf4310316s16868.html#a13761128
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.