some extra debugging/javadoc
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2426 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
5cc81fd017
commit
cf7f8b27f8
|
@ -438,6 +438,13 @@ public abstract class SelectorManager extends AbstractLifeCycle
|
|||
else
|
||||
Log.debug(e);
|
||||
}
|
||||
catch (Error e)
|
||||
{
|
||||
if (isRunning())
|
||||
Log.warn(e);
|
||||
else
|
||||
Log.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ import org.eclipse.jetty.util.thread.ThreadPool;
|
|||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author gregw
|
||||
*
|
||||
*/
|
||||
public interface Connector extends LifeCycle
|
||||
{
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -226,7 +230,14 @@ public interface Connector extends LifeCycle
|
|||
int getLocalPort();
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Max Idle time for connections in milliseconds
|
||||
*/
|
||||
int getMaxIdleTime();
|
||||
|
||||
/**
|
||||
* @param ms Max Idle time for connections in milliseconds
|
||||
*/
|
||||
void setMaxIdleTime(int ms);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.io.IOException;
|
|||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
||||
|
@ -27,6 +28,11 @@ import org.eclipse.jetty.util.log.Log;
|
|||
public class LocalConnector extends AbstractConnector
|
||||
{
|
||||
private final BlockingQueue<Request> requests = new LinkedBlockingQueue<Request>();
|
||||
|
||||
public LocalConnector()
|
||||
{
|
||||
setMaxIdleTime(30000);
|
||||
}
|
||||
|
||||
public Object getConnection()
|
||||
{
|
||||
|
@ -49,7 +55,7 @@ public class LocalConnector extends AbstractConnector
|
|||
CountDownLatch latch = new CountDownLatch(1);
|
||||
Request request = new Request(requestsBuffer, keepOpen, latch);
|
||||
requests.add(request);
|
||||
latch.await();
|
||||
latch.await(getMaxIdleTime(),TimeUnit.MILLISECONDS);
|
||||
return request.getResponsesBuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
|||
private int _lowResourcesConnections;
|
||||
private int _lowResourcesMaxIdleTime;
|
||||
private int _localPort=-1;
|
||||
private Throwable _closedBy;
|
||||
|
||||
private final SelectorManager _manager = new SelectorManager()
|
||||
{
|
||||
|
@ -141,6 +142,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
|||
_acceptChannel.close();
|
||||
_acceptChannel = null;
|
||||
_localPort=-2;
|
||||
_closedBy=new Throwable();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,6 +176,8 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
|||
{
|
||||
synchronized(this)
|
||||
{
|
||||
if (_localPort<0)
|
||||
Log.warn("Closed By",_closedBy);
|
||||
return _localPort;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue