jetty-9 some findbug cleanups

This commit is contained in:
Greg Wilkins 2012-05-08 14:09:50 +02:00
parent 7e8a627b92
commit dc02390449
6 changed files with 22 additions and 21 deletions

View File

@ -165,10 +165,11 @@ public class AsyncByteArrayEndPoint extends ByteArrayEndPoint implements AsyncEn
_readFuture.fail(new TimeoutException()); _readFuture.fail(new TimeoutException());
if (!_writeFuture.isComplete()) if (!_writeFuture.isComplete())
_writeFuture.fail(new TimeoutException()); _writeFuture.fail(new TimeoutException());
notIdle();
} }
finally finally
{ {
notIdle();
_lock.unlock(); _lock.unlock();
} }
} }

View File

@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
*/ */
public interface Buffers public interface Buffers
{ {
enum Type { DIRECT, INDIRECT } ; enum Type { DIRECT, INDIRECT }
ByteBuffer getHeader(); ByteBuffer getHeader();
ByteBuffer getBuffer(); ByteBuffer getBuffer();

View File

@ -28,16 +28,12 @@ public class DispatchedIOFuture implements IOFuture
public DispatchedIOFuture() public DispatchedIOFuture()
{ {
// System.err.println(this);new Throwable().printStackTrace(); this(false,new ReentrantLock());
_lock = new ReentrantLock();
_block = _lock.newCondition();
} }
public DispatchedIOFuture(Lock lock) public DispatchedIOFuture(Lock lock)
{ {
// System.err.println(this);new Throwable().printStackTrace(); this(false,lock);
_lock = lock;
_block = _lock.newCondition();
} }
public DispatchedIOFuture(boolean ready,Lock lock) public DispatchedIOFuture(boolean ready,Lock lock)
@ -209,7 +205,7 @@ public class DispatchedIOFuture implements IOFuture
protected void dispatch(Runnable callback) protected void dispatch(Runnable callback)
{ {
new Thread(callback).run(); new Thread(callback).start();
} }
private void dispatchReady() private void dispatchReady()

View File

@ -195,10 +195,10 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
_readFuture.fail(new TimeoutException()); _readFuture.fail(new TimeoutException());
if (!_writeFuture.isComplete()) if (!_writeFuture.isComplete())
_writeFuture.fail(new TimeoutException()); _writeFuture.fail(new TimeoutException());
notIdle();
} }
finally finally
{ {
notIdle();
_lock.unlock(); _lock.unlock();
} }
} }
@ -443,15 +443,18 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
_lock.lock(); _lock.lock();
try try
{ {
super.close(); try
} {
catch (IOException e) super.close();
{ }
LOG.ignore(e); catch (IOException e)
{
LOG.ignore(e);
}
updateKey();
} }
finally finally
{ {
updateKey();
_lock.unlock(); _lock.unlock();
} }
} }

View File

@ -202,7 +202,7 @@ public class IOFutureTest
@Override @Override
public void run() public void run()
{ {
try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){} try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){e.printStackTrace();}
f0.ready(); f0.ready();
} }
}.start(); }.start();
@ -229,7 +229,7 @@ public class IOFutureTest
@Override @Override
public void run() public void run()
{ {
try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){} try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){e.printStackTrace();}
f1.ready(); f1.ready();
} }
}.start(); }.start();
@ -285,7 +285,7 @@ public class IOFutureTest
@Override @Override
public void run() public void run()
{ {
try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){} try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){e.printStackTrace();}
f0.fail(ex); f0.fail(ex);
} }
}.start(); }.start();
@ -328,7 +328,7 @@ public class IOFutureTest
@Override @Override
public void run() public void run()
{ {
try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){} try{TimeUnit.MILLISECONDS.sleep(50);}catch(Exception e){e.printStackTrace();}
f1.fail(ex); f1.fail(ex);
} }
}.start(); }.start();

View File

@ -360,7 +360,8 @@ public class SelectChannelEndPointTest
clientOutputStream.write("12345678".getBytes("UTF-8")); clientOutputStream.write("12345678".getBytes("UTF-8"));
clientOutputStream.flush(); clientOutputStream.flush();
while(_lastEndp==null); while(_lastEndp==null)
Thread.sleep(10);
_lastEndp.setMaxIdleTime(10*specifiedTimeout); _lastEndp.setMaxIdleTime(10*specifiedTimeout);
Thread.sleep(2 * specifiedTimeout); Thread.sleep(2 * specifiedTimeout);