...and a basic example test can be found here:
https://grizzly.dev.java.net/nonav/xref-test/com/sun/grizzly/SuspendableTest.html
-- Jeanfrancois
Jeanfrancois Arcand wrote:
> Hi,
>
> I've added a new ProtocolFilter:
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/suspendable/package-summary.html
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/suspendable/SuspendableFilter.html
>
>
> which I name SuspendableFilter. This filter allow an application to
> suspend a request and either let the framework to resume it after some
> timeout, or use a Suspendable object to decide when to resume it:
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/suspendable/Suspendable.html
>
>
> A connection will by suspended based on very simple pattern matching
> algorithm (really simple now, will add full regex support soon).
> When the request comes it, the filter will try to match some token to
> the byte buffer, and suspend the connection if the match occurs. Right
> now there is two way to suspend a connection:
>
> 1. If there is a match, invoke the remaining ProtocolFilter, and then
> suspend once the SuspendableFilter.postExecute is called (Suspend.AFTER)
>
> 2. If there is a match, do not invoke the remaining ProtocolFilter. When
> the Suspendable.resume is invoked or the timeout expire, invoke the
> remaining ProtocolFilter. (Suspend.BEFORE}
>
> When a connection is resumed, it is always possible to do some
> processing before the ProtocolFilter get invoked:
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/suspendable/SuspendableHandler.html
>
>
> This mechanism can now be used to throttle requests, implement QoS, do
> Comet at the transport layer, etc. There is more work to be done
> (implement a better pattern matching algorithm), so feel free to jump if
> you are interested.
>
> Any feedback appreciated :-)
>
> -- Jeanfrancois
>