Hi,
see inline
>> Yes, but take a look at AIO:
>>
>> http://openjdk.java.net/projects/nio/javadoc/java/nio/channels/AsynchronousSocketChannel.html
>>
>>
>> They do the same thing with a unified API :-) I would like us to do
>> the same.
> Grizzly API is more general.
> Grizzly's Connection.read/write may use transformers, which means, that
> result could be not just Integer, but any type.
> For example, If you'll take a look at DatagramChannel [1], there are
> 2 different methods write/send, read/receive; with Grizzly we will have
> just one.
why are there in AIO 2 different methods. What's the difference other then returning
bytes read or socketAddress?
> Future<Connection> future = connectionHandler.connect(...);
> Connection connection = future.get();
>
> The same situation with read and write. So, IMHO, it should be fine?
> It just depends on developer's style.
>
>
> > I would like to align with the API and remove the above classes and
> > instead add something like GrizzlyFuture. Looking at the code, the
> > specialized API added to the above classes can be replaced with
> >
> > public R get() // Instead of getResults, which return the same as
> > get anyway.
> getResult() is not the same as get().
> getResult() returns result immediately, possibly null if result is not
> ready yet.
>
> > Same for getImmediateReadResult, getImmediateWriteResult, etc. which
> > can anyway get retrieved using Future.get().
> Again, it's not the same. ImmediateResult returns current operation
> state.
> iofuture.get() - returns final result. Will block until result is not
> ready
> iofuture.getResult() - returns final result. Will not block. If final
> result is not ready - null will be returned.
For me doing
Future<ReadResult<?, ?> > readFuture = connection.read(...)
is clearer then
ReadFuture<?, ?> readFuture = connection.read(....)
but I don't buy Future.get(0,TimeUnit).
so also as David pointed out I aggree one needs a speicalized IO Interface.
But I don't see a real need (or I am ovelooking something) for
getImmediateReadResult() I would unify getImmediateResult() to getResult() and have a status defining
the kind.
Many Greetings John
--
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a