mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Harvey (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DIRMINA-375) Synchronous Client API
Date Sun, 14 Oct 2007 10:51:50 GMT

    [ https://issues.apache.org/jira/browse/DIRMINA-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534623
] 

Brad Harvey commented on DIRMINA-375:
-------------------------------------

Sorry for delayed response.  I have been *extremely* busy sipping cocktails and generally
lazing about on my honeymoon :)  Alas, all good things must come to an end!

Certainly integrating into IoSession is a great idea - I didn't consider this in my implementation
as I wanted something purely additive.  This opens up the possibility of having an IO Handler
as well as blocking reads - you will need to define when/if the IoHandler callback is called
if there is also a ReadFuture from IoSession.read().  

I would urge some caution in providing an API with slight differences in returning null vs
throwing exception as suggested above:
* Object m = session.read().await(10000).getMessage(); // Returns null unless received within
10 sec.
* Object m = session.read(10000).await().getMessage(); // Throws exception unless received
within 10 sec.

These two statements are very similar but have a very subtle difference that is not intuitive
and likely to be a source of confusion (especially if the latter throws unchecked exceptions).

I suspect that the needs of most people looking for a synchronous API (who are probably new
to MINA) would be met best by hiding/short circuiting the ReadFuture, eg:

* Object m = session.getMessage(); // or readMessage() or whatever, waits forever for message
* Object m = session.getMessage(10000); // Throws timeout exception unless received within
10 sec.

This would certainly make for an easier tutorial :)  Advanced users may like to use session.read(10000)
since the ReadFuture returned offers a bit more flexibility and power.

Cheers,
Brad. 

> Synchronous Client API
> ----------------------
>
>                 Key: DIRMINA-375
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-375
>             Project: MINA
>          Issue Type: New Feature
>            Reporter: Brad Harvey
>             Fix For: 2.0.0-M1
>
>         Attachments: EchoClient.java, minaClient.patch, SumUpClient.java
>
>
> Hi,
> There was mention of a synchronous client api for MINA on the mailing list, so I thought
I'd offer my implementation.
> http://www.nabble.com/forum/ViewPost.jtp?post=10445399&framed=y
> As far as I can tell it works, but I've never given it a good run under heavy load. 
The areas I think could use some review are:
> Connection - possible to use generics?  Only makes sense if you can tie it to what the
filters are doing I think.
> ConnectionFactoryImpl - is the managedSessions processing required?
> SequentialExecutor/DaemonThreadFactory - are there better/pre existing ways of doing
these?
> Connection/NonBlockingConnection - any point having them separate?  Did this initially
for JCA resource adapter idea - didn't want to offer non blocking to EJB clients.
> Regards,
> Brad.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message