Hi Scott,

I get deadlocks with the following test code:

File indDir = new File( "C:\\index" );
for ( int i = 0; i < 49; i++ )
{
  IndexReader reader = IndexAccessControl.getReader( indDir );
  Thread t = new Thread()
  {
    public void run()
    {
      File indDir = new File( "C:\\index" );
      try
      {
        IndexWriter writer = IndexAccessControl.getWriter( indDir );
        IndexAccessControl.releaseWriter( indDir, writer );
      }
      catch ( IOException e )
      {
        e.printStackTrace();
      }
    }
  };
  t.start();
  System.out.println( i );
  IndexAccessControl.releaseReader( indDir, reader );
}


To avoid that i decided to synchronize (and wait/notify) only on sync.
Since that it looks like it works correctly. What do you think?


Regards,
Ilya



-----Original Message-----
From: Scott Ganyo [mailto:[EMAIL PROTECTED]] 
Sent: Montag, 8. Juli 2002 16:28
To: 'Lucene Users List'
Subject: RE: IndexReader Pool


Deadlocks could be created if the order in which locks are obtained is
not consistent.  Note, though, that the locks are obtained in the same
order each time throughout.  (BTW: The inner lock is merely needed
because the wait/notify calls need to own the monitor.)

Naturally, you are free to make any suggestions for improvement! :)

Scott


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to