AsynchronousByteCharChannel and Timeouts

Gili cowwoc at bbs.darktech.org
Fri Jul 31 10:56:58 PDT 2009


Alternatively, we could define these methods in AsynchronousByteChannel and
mark them as optional. Subclasses would then document whether they support
timeouts or not. This would be a similar design to Collections.

I'm still trying to figure out how to design AsynchronousByteCharChannel for
AsynchronousByteChannels with timeouts and without. If the timeout methods
are optional then the design becomes quite simple. If not, I might have to
create two different adapters: one for ByteChannels with timeouts, one for
ones without it.

Ideas anyone?

Gili


Gili wrote:
> 
> I just defined such an interface. Let me know what you think:
> 
>  http://n2.nabble.com/file/n3363044/AsynchronousByteChannelTimeouts.java
> AsynchronousByteChannelTimeouts.java 
> 
> Gili
> 
> 
> Gili wrote:
>> 
>> Hi,
>> 
>> Is it possible to move the timeout-related methods out of
>> AsynchronousSocketChannel into their own  interface? I want
>> AsynchronousByteCharChannel (character/line reader on top of an
>> AsynchronousByteChannel) to be able to function on top of
>> AsynchronousByteChannels that support timeouts. AsynchronousSocketChannel
>> is one such channel, but so is SerialPortChannel which I've implemented
>> on my end.
>> 
>> The methods in question are:
>> 
>>   void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment,
>> CompletionHandler<Integer, ? super A> handler);
>>   void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment,
>> CompletionHandler<Integer, ? super A> handler);
>> 
>> Thanks,
>> Gili
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/AsynchronousByteCharChannel-and-Timeouts-tp3363004p3364126.html
Sent from the nio-discuss mailing list archive at Nabble.com.



More information about the nio-discuss mailing list