bloritsch 2002/08/09 12:06:51
Modified: event/src/java/org/apache/excalibur/mpool FixedSizePool.java
event/src/test/org/apache/excalibur/event/command/test
TPCThreadManagerTestCase.java
Log:
remove the blocking code from FixedSizedPool
Revision Changes Path
1.4 +4 -28
jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/mpool/FixedSizePool.java
Index: FixedSizePool.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/mpool/FixedSizePool.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FixedSizePool.java 9 Aug 2002 05:32:03 -0000 1.3
+++ FixedSizePool.java 9 Aug 2002 19:06:51 -0000 1.4
@@ -68,18 +68,10 @@
private boolean m_disposed = false;
private final Buffer m_buffer;
private final ObjectFactory m_factory;
- private final long m_timeout;
public FixedSizePool( ObjectFactory factory, int size )
throws Exception
{
- this( factory, size, 1000L );
- }
-
- public FixedSizePool( ObjectFactory factory, int size, long timeout )
- throws Exception
- {
- m_timeout = (timeout < 1) ? 1 : timeout;
m_buffer = new FixedSizeBuffer( size );
m_factory = factory;
@@ -98,27 +90,11 @@
Object object = null;
- long start = System.currentTimeMillis();
- long end = start + m_timeout;
-
- while ( null == object && System.currentTimeMillis() < end)
+ synchronized( m_buffer )
{
- synchronized( m_buffer )
- {
- if ( m_buffer.isEmpty() )
- {
- try
- {
- m_buffer.wait( m_timeout );
- }
- catch (InterruptedException e) {}
- }
- else
- {
- object = m_buffer.remove();
- }
- }
+ object = m_buffer.remove();
}
+
return object;
}
1.7 +0 -2
jakarta-avalon-excalibur/event/src/test/org/apache/excalibur/event/command/test/TPCThreadManagerTestCase.java
Index: TPCThreadManagerTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/event/src/test/org/apache/excalibur/event/command/test/TPCThreadManagerTestCase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TPCThreadManagerTestCase.java 9 Aug 2002 19:01:12 -0000 1.6
+++ TPCThreadManagerTestCase.java 9 Aug 2002 19:06:51 -0000 1.7
@@ -178,7 +178,6 @@
public void handleEvents( QueueElement[] elements )
{
-System.out.println("handled event");
// records the fact that the handler was called
m_result.append( 'a' );
try
@@ -189,7 +188,6 @@
m_queue.enqueue( new QueueElement()
{
} );
- System.out.println("added element");
}
catch( Exception e )
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>