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());
if (!_writeFuture.isComplete())
_writeFuture.fail(new TimeoutException());
notIdle();
}
finally
{
notIdle();
_lock.unlock();
}
}

View File

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

View File

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

View File

@ -195,10 +195,10 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
_readFuture.fail(new TimeoutException());
if (!_writeFuture.isComplete())
_writeFuture.fail(new TimeoutException());
notIdle();
}
finally
{
notIdle();
_lock.unlock();
}
}
@ -441,6 +441,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
public void close() throws IOException
{
_lock.lock();
try
{
try
{
super.close();
@ -449,9 +451,10 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
{
LOG.ignore(e);
}
updateKey();
}
finally
{
updateKey();
_lock.unlock();
}
}

View File

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

View File

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