434009 Improved javadoc for accessing HttpChannel and HttpConnection

This commit is contained in:
Greg Wilkins 2014-05-05 10:00:06 +02:00
parent 871b330ba8
commit c6f394ab14
2 changed files with 12 additions and 0 deletions

View File

@ -73,6 +73,11 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
private static final Logger LOG = Log.getLogger(HttpChannel.class);
private static final ThreadLocal<HttpChannel<?>> __currentChannel = new ThreadLocal<>();
/* ------------------------------------------------------------ */
/** Get the current channel that this thread is dispatched to.
* @see Request#getAttribute(String) for a more general way to access the HttpChannel
* @return the current HttpChannel or null
*/
public static HttpChannel<?> getCurrentHttpChannel()
{
return __currentChannel.get();

View File

@ -62,6 +62,13 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
private volatile ByteBuffer _chunk = null;
/* ------------------------------------------------------------ */
/** Get the current connection that this thread is dispatched to.
* Note that a thread may be processing a request asynchronously and
* thus not be dispatched to the connection.
* @see Request#getAttribute(String) for a more general way to access the HttpConnection
* @return the current HttpConnection or null
*/
public static HttpConnection getCurrentConnection()
{
return __currentConnection.get();