diff src/org/eclipse/jetty/server/AsyncContinuation.java @ 936:237ace6e8bc2

simplify AsyncContinuation
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 09 Oct 2016 21:35:26 -0600
parents aa7dc1802d29
children 0541b6034003
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/AsyncContinuation.java	Sun Oct 09 21:15:24 2016 -0600
+++ b/src/org/eclipse/jetty/server/AsyncContinuation.java	Sun Oct 09 21:35:26 2016 -0600
@@ -18,26 +18,12 @@
 
 package org.eclipse.jetty.server;
 
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
 import org.eclipse.jetty.continuation.Continuation;
-import org.eclipse.jetty.io.AsyncEndPoint;
 import org.eclipse.jetty.io.EndPoint;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.server.handler.ContextHandler.Context;
-import org.eclipse.jetty.util.URIUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /* ------------------------------------------------------------ */
 /** Implementation of Continuation interfaces
  * 
@@ -71,7 +57,6 @@
 
 	/* ------------------------------------------------------------ */
 	private int _state;
-	private volatile long _expireAt;    
 	
 	AsyncContinuation()
 	{
@@ -85,25 +70,19 @@
 
 	
 	@Override
-	public String toString()
+	public synchronized String toString()
 	{
-		synchronized (this)
-		{
-			return super.toString()+"@"+getStatusString();
-		}
+		return super.toString()+"@"+getStatusString();
 	}
 
-	public String getStatusString()
+	private synchronized String getStatusString()
 	{
-		synchronized (this)
-		{
-			return
-			((_state==__IDLE)?"IDLE":
-				(_state==__DISPATCHED)?"DISPATCHED":
-											(_state==__UNCOMPLETED)?"UNCOMPLETED":
-												(_state==__COMPLETED)?"COMPLETE":
-													("UNKNOWN?"+_state));
-		}
+		return
+		((_state==__IDLE)?"IDLE":
+			(_state==__DISPATCHED)?"DISPATCHED":
+										(_state==__UNCOMPLETED)?"UNCOMPLETED":
+											(_state==__COMPLETED)?"COMPLETE":
+												("UNKNOWN?"+_state));
 	}
 
 	protected synchronized void handling()
@@ -166,86 +145,20 @@
 		cancelTimeout();
 	}    
 	
-	/* ------------------------------------------------------------ */
-	protected void cancelTimeout()
+	private void cancelTimeout()
 	{
 		EndPoint endp=_connection.getEndPoint();
 		if (endp.isBlocking())
 		{
 			synchronized(this)
 			{
-				_expireAt=0;
 				this.notifyAll();
 			}
 		}
-		else 
-		{
-		}
 	}
 
 	synchronized boolean isUncompleted()
 	{
 		return _state==__UNCOMPLETED;
 	} 
-	
-	public synchronized boolean isComplete()
-	{
-		return _state==__COMPLETED;
-	}
-
-	/* ------------------------------------------------------------ */
-	public Request getBaseRequest()
-	{
-		return _connection.getRequest();
-	}
-	
-	/* ------------------------------------------------------------ */
-	public ServletRequest getRequest()
-	{
-		return _connection.getRequest();
-	}
-
-	/* ------------------------------------------------------------ */
-	public ServletResponse getResponse()
-	{
-		return _connection.getResponse();
-	}
-
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.continuation.Continuation#getServletResponse()
-	 */
-	public ServletResponse getServletResponse()
-	{
-		return _connection.getResponse();
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.continuation.Continuation#getAttribute(java.lang.String)
-	 */
-	public Object getAttribute(String name)
-	{
-		return _connection.getRequest().getAttribute(name);
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.continuation.Continuation#removeAttribute(java.lang.String)
-	 */
-	public void removeAttribute(String name)
-	{
-		_connection.getRequest().removeAttribute(name);
-	}
-
-	/* ------------------------------------------------------------ */
-	/**
-	 * @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object)
-	 */
-	public void setAttribute(String name, Object attribute)
-	{
-		_connection.getRequest().setAttribute(name,attribute);
-	}
-
 }