directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trustin Lee <>
Subject Re: Suggestions on implementing timeouts?
Date Wed, 20 Jul 2005 01:12:00 GMT
Ah, I see. I implemented that when I was working for a telco company. You 
can simply use java.util.Timer. Just schedule timeout TimerTasks for each 
messages. Timer will automatically call your so that you can 
process timeout event. Of course you'll have to cancel the task whenever you 
get a response.

I guess this approach doesn't have much overload comparing to the time taken 
by transactions. I have been using this techinique for sending about 30 SMSs 
a second.


2005/7/20, Alex Burmester <>:
> My server has to keep incomming connections open to a third party
> and route multiple messages over the same channel using transaction ids
> to keep track of which messages are outstanding. I need a way to time out
> these transactions. Currently every half second I scan my outstanding
> message queues and remove any messages that are older than the timeout. My
> issue with this is that the cleanup method has to lock the whole complex
> datastructure of connections and outstanding messages during the scan.
> Doesn't seem to be a problem yet but I'm concerned that under higher load 
> it
> will become the main bottleneck. I was thinking about putting in an event
> queue and firing timeout events for each message but I'm not sure if the 
> overhead
> of registering and deregistering each timeout event for each successful
> message is worth it. Just wondering if there is a pattern that I'm not
> thinking of that gets around these issues.

what we call human nature is actually human habit

View raw message