jetty-9 removed AsyncConnection interface
This commit is contained in:
parent
2b78e69ac9
commit
7e8a627b92
|
@ -1,16 +1,12 @@
|
|||
package org.eclipse.jetty.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
||||
public abstract class AbstractAsyncConnection implements AsyncConnection
|
||||
public abstract class AbstractAsyncConnection
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(AbstractAsyncConnection.class);
|
||||
protected final AsyncEndPoint _endp;
|
||||
|
@ -23,14 +19,16 @@ public abstract class AbstractAsyncConnection implements AsyncConnection
|
|||
_endp=endp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void onReadable();
|
||||
public abstract void onClose();
|
||||
|
||||
|
||||
public AsyncEndPoint getEndPoint()
|
||||
{
|
||||
return _endp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onIdleExpired(long idleForMs)
|
||||
{
|
||||
try
|
||||
|
@ -56,7 +54,6 @@ public abstract class AbstractAsyncConnection implements AsyncConnection
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOFuture scheduleOnReadable()
|
||||
{
|
||||
IOFuture read=getEndPoint().readable();
|
||||
|
@ -64,7 +61,6 @@ public abstract class AbstractAsyncConnection implements AsyncConnection
|
|||
return read;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReadFail(Throwable cause)
|
||||
{
|
||||
LOG.debug("read failed: "+cause);
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.eclipse.jetty.io;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public abstract class AbstractEndPoint implements EndPoint
|
||||
{
|
||||
|
|
|
@ -13,25 +13,20 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
|
||||
public class AsyncByteArrayEndPoint extends ByteArrayEndPoint implements AsyncEndPoint
|
||||
{
|
||||
|
||||
|
||||
|
||||
public static final Logger LOG=Log.getLogger(AsyncByteArrayEndPoint.class);
|
||||
|
||||
private final Lock _lock = new ReentrantLock();
|
||||
private volatile boolean _idlecheck;
|
||||
|
||||
private volatile AsyncConnection _connection;
|
||||
private volatile AbstractAsyncConnection _connection;
|
||||
|
||||
private DispatchedIOFuture _readFuture;
|
||||
private DispatchedIOFuture _writeFuture;
|
||||
|
||||
private ByteBuffer[] _writeBuffers;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AsyncConnection getAsyncConnection()
|
||||
|
||||
public AbstractAsyncConnection getAsyncConnection()
|
||||
{
|
||||
return _connection;
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 2010 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.io;
|
||||
|
||||
|
||||
public interface AsyncConnection
|
||||
{
|
||||
AsyncEndPoint getEndPoint();
|
||||
|
||||
IOFuture scheduleOnReadable();
|
||||
|
||||
void onReadable();
|
||||
void onReadFail(Throwable cause);
|
||||
void onClose();
|
||||
void onIdleExpired(long idleForMs);
|
||||
|
||||
}
|
|
@ -82,9 +82,6 @@ import java.util.concurrent.Future;
|
|||
*/
|
||||
public interface AsyncEndPoint extends EndPoint
|
||||
{
|
||||
/* ------------------------------------------------------------ */
|
||||
AsyncConnection getAsyncConnection();
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Schedule a read operation.
|
||||
* <p>
|
||||
|
|
|
@ -3,8 +3,6 @@ package org.eclipse.jetty.io;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
|
||||
public class CompletedIOFuture implements IOFuture
|
||||
{
|
||||
private final boolean _ready;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
package org.eclipse.jetty.io;
|
||||
|
||||
import static org.eclipse.jetty.io.CompletedIOFuture.COMPLETE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SelectableChannel;
|
||||
|
@ -26,7 +28,6 @@ import org.eclipse.jetty.io.SelectorManager.SelectSet;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.thread.Timeout.Task;
|
||||
import static org.eclipse.jetty.io.CompletedIOFuture.COMPLETE;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
@ -75,8 +76,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public AsyncConnection getAsyncConnection()
|
||||
public AbstractAsyncConnection getAsyncConnection()
|
||||
{
|
||||
return _connection;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
/* ------------------------------------------------------------ */
|
||||
public void setAsyncConnection(AbstractAsyncConnection connection)
|
||||
{
|
||||
AsyncConnection old=getAsyncConnection();
|
||||
AbstractAsyncConnection old=getAsyncConnection();
|
||||
_connection=connection;
|
||||
if (old!=null && old!=connection)
|
||||
_manager.endPointUpgraded(this,old);
|
||||
|
|
|
@ -337,7 +337,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
protected abstract void endPointOpened(SelectChannelEndPoint endpoint);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected abstract void endPointUpgraded(SelectChannelEndPoint endpoint,AsyncConnection oldConnection);
|
||||
protected abstract void endPointUpgraded(SelectChannelEndPoint endpoint,AbstractAsyncConnection oldConnection);
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
public abstract AbstractAsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint, Object attachment);
|
||||
|
@ -839,7 +839,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
{
|
||||
LOG.debug("destroyEndPoint {}",endp);
|
||||
_endPoints.remove(endp);
|
||||
AsyncConnection connection=endp.getAsyncConnection();
|
||||
AbstractAsyncConnection connection=endp.getAsyncConnection();
|
||||
if (connection!=null)
|
||||
connection.onClose();
|
||||
endPointClosed(endp);
|
||||
|
|
|
@ -745,8 +745,7 @@ public class SslConnection extends AbstractAsyncConnection
|
|||
return _endp.getCreatedTimeStamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncConnection getAsyncConnection()
|
||||
public AbstractAsyncConnection getAsyncConnection()
|
||||
{
|
||||
return _appConnection;
|
||||
}
|
||||
|
@ -832,5 +831,4 @@ public class SslConnection extends AbstractAsyncConnection
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.eclipse.jetty.io;
|
|||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import org.eclipse.jetty.io.ChannelEndPoint;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.eclipse.jetty.io;
|
||||
|
||||
import static org.hamcrest.number.OrderingComparison.*;
|
||||
import static org.hamcrest.number.OrderingComparison.greaterThan;
|
||||
import static org.hamcrest.number.OrderingComparison.lessThan;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
|
|
@ -11,10 +11,6 @@ import javax.net.ssl.SSLEngineResult;
|
|||
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
|
||||
import org.eclipse.jetty.io.AsyncConnection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.SelectorManager;
|
||||
import org.eclipse.jetty.io.SslConnection;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.Assert;
|
||||
|
|
|
@ -11,24 +11,16 @@ import java.io.BufferedOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.jetty.io.AsyncConnection;
|
||||
import org.eclipse.jetty.io.AbstractAsyncConnection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.SelectorManager;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
|
@ -61,7 +53,7 @@ public class SelectChannelEndPointTest
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void endPointUpgraded(SelectChannelEndPoint endpoint, AsyncConnection oldConnection)
|
||||
protected void endPointUpgraded(SelectChannelEndPoint endpoint, AbstractAsyncConnection oldConnection)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue