Is there a way to tell the read-side of a Mina-session to slow down?

Example setup:

Socket ===> Speed Reducer -> Protocol Handler -> (Handler) Message Processor


Message Processor may take a short while to finish processing messages and sending responses and I want to be able to slow down the socket to avoid pulling in too much data... depending on the data amount for request/response, the data queue could get quite large... a 128-byte request may end up prompting a multi-megabyte transfer... not quite the thing I want many many to show up...

The way I see it could work out is that the Message Processor could detect that there are too many outstanding messages (per session / globally) and flag the speed reducer to slow down the read side. Perhaps extra handling would go in to detect if some outstanding responses are huge and wait until even more are completed before resuming operation. Semaphores w/ counts being associated w/ x-amt of resources seem to make sense... except that it would involve blocking... not quite the way Mina works.

I've looked at the executor-filter and its throttling mechanism, but I cannot really understand /how/ it is slowing things down......

Reply via email to