simplifications and fixes from porting auction to oort

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@325 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-06-01 05:04:37 +00:00
parent f3926b4bf7
commit 8f940927ff
4 changed files with 30 additions and 6 deletions

View File

@ -104,7 +104,9 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); Log.warn(e.toString());
Log.debug(e);
Thread.yield();
} }
} }
} }

View File

@ -58,7 +58,7 @@ public class ContinuationFilter implements Filter
{ {
if (_faux) if (_faux)
{ {
final FauxContinuation fc = new FauxContinuation(this, request,response); final FauxContinuation fc = new FauxContinuation(request,response);
request.setAttribute(Continuation.ATTRIBUTE,fc); request.setAttribute(Continuation.ATTRIBUTE,fc);
boolean complete=false; boolean complete=false;

View File

@ -20,6 +20,9 @@ import javax.servlet.ServletResponse;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** ContinuationSupport. /** ContinuationSupport.
*
* Factory class for accessing Continuation instances, which with either be
* native to the container (jetty >= 6), a servlet 3.0 or a faux continuation.
* *
*/ */
public class ContinuationSupport public class ContinuationSupport
@ -66,11 +69,32 @@ public class ContinuationSupport
} }
} }
/* ------------------------------------------------------------ */
/**
* @param request
* @deprecated use {@link #getContinuation(ServletRequest, ServletResponse)}
* @return a Continuation instance
*/
public static Continuation getContinuation(final ServletRequest request)
{
return getContinuation(request,null);
}
/* ------------------------------------------------------------ */
/**
* @param request
* @param response
* @return
*/
public static Continuation getContinuation(final ServletRequest request, final ServletResponse response) public static Continuation getContinuation(final ServletRequest request, final ServletResponse response)
{ {
Continuation continuation = (Continuation) request.getAttribute(Continuation.ATTRIBUTE); Continuation continuation = (Continuation) request.getAttribute(Continuation.ATTRIBUTE);
if (continuation!=null) if (continuation!=null)
{
// TODO save wrappers?
return continuation; return continuation;
}
if (__servlet3 ) if (__servlet3 )
{ {

View File

@ -21,7 +21,6 @@ import javax.servlet.ServletResponse;
class FauxContinuation implements Continuation class FauxContinuation implements Continuation
{ {
private final ContinuationFilter _continuationFilter;
private static final int __HANDLING=1; // Request dispatched to filter/servlet private static final int __HANDLING=1; // Request dispatched to filter/servlet
private static final int __SUSPENDING=2; // Suspend called, but not yet returned to container private static final int __SUSPENDING=2; // Suspend called, but not yet returned to container
private static final int __RESUMING=3; // resumed while suspending private static final int __RESUMING=3; // resumed while suspending
@ -42,9 +41,8 @@ class FauxContinuation implements Continuation
private ArrayList<ContinuationListener> _listeners; private ArrayList<ContinuationListener> _listeners;
FauxContinuation(ContinuationFilter continuationFilter, final ServletRequest request,final ServletResponse response) FauxContinuation(final ServletRequest request,final ServletResponse response)
{ {
_continuationFilter = continuationFilter;
_request=request; _request=request;
_response=response; _response=response;
} }
@ -397,7 +395,7 @@ class FauxContinuation implements Continuation
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
_continuationFilter._context.log("OpenServletFilter caught ",e); break;
} }
wait=expire_at-System.currentTimeMillis(); wait=expire_at-System.currentTimeMillis();
} }