net.jini.jeri.http
Class HttpServerEndpoint.LH

java.lang.Object
  extended by net.jini.jeri.http.HttpServerEndpoint.LH
All Implemented Interfaces:
ServerEndpoint.ListenHandle
Enclosing class:
HttpServerEndpoint

private static class HttpServerEndpoint.LH
extends Object
implements ServerEndpoint.ListenHandle

ListenHandle implementation: represents a listen operation.


Nested Class Summary
private  class HttpServerEndpoint.LH.Connection
          HttpServerConnection subclass.
 
Field Summary
private  int acceptFailureCount
           
private  long acceptFailureTime
           
private  boolean closed
           
private  Set conns
           
private  SecurityContext context
           
private  ServerEndpoint.ListenCookie cookie
           
private  Object lock
           
private  RequestDispatcher requestDispatcher
           
private  ServerSocket serverSocket
           
 
Constructor Summary
HttpServerEndpoint.LH(RequestDispatcher requestDispatcher, ServerSocket serverSocket, SecurityContext context, ServerEndpoint.ListenCookie cookie)
           
 
Method Summary
 void close()
          Stops this listen operation.
private  boolean continueAfterAcceptFailure(Throwable t)
          Throttles the accept loop after ServerSocket.accept throws an exception, and decides whether to continue at all.
private  void executeAcceptLoop()
          Runs the accept loop in the access control context preserved by LE.listen.
private  void executeAcceptLoop0()
          Executes the accept loop.
 ServerEndpoint.ListenCookie getCookie()
          Returns a cookie to identify this listen operation.
(package private)  void startAccepting()
          Starts the accept loop.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

requestDispatcher

private final RequestDispatcher requestDispatcher

serverSocket

private final ServerSocket serverSocket

context

private final SecurityContext context

cookie

private final ServerEndpoint.ListenCookie cookie

acceptFailureTime

private long acceptFailureTime

acceptFailureCount

private int acceptFailureCount

lock

private final Object lock

closed

private boolean closed

conns

private final Set conns
Constructor Detail

HttpServerEndpoint.LH

HttpServerEndpoint.LH(RequestDispatcher requestDispatcher,
                      ServerSocket serverSocket,
                      SecurityContext context,
                      ServerEndpoint.ListenCookie cookie)
Method Detail

startAccepting

void startAccepting()
Starts the accept loop.


executeAcceptLoop

private void executeAcceptLoop()
Runs the accept loop in the access control context preserved by LE.listen.


executeAcceptLoop0

private void executeAcceptLoop0()
Executes the accept loop.


close

public void close()
Stops this listen operation.

Specified by:
close in interface ServerEndpoint.ListenHandle

getCookie

public ServerEndpoint.ListenCookie getCookie()
Returns a cookie to identify this listen operation.

Specified by:
getCookie in interface ServerEndpoint.ListenHandle
Returns:
a ListenCookie to identify the listen operation

toString

public String toString()
Overrides:
toString in class Object

continueAfterAcceptFailure

private boolean continueAfterAcceptFailure(Throwable t)
Throttles the accept loop after ServerSocket.accept throws an exception, and decides whether to continue at all. The current code is borrowed from the JRMP implementation; it always continues, but it delays the loop after bursts of failed accepts.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.