bugfixes for new compilation, particularly with Lucene 1.3-final
This commit is contained in:
parent
8514d152f1
commit
c2552a9e70
2
drivers/.gitignore
vendored
2
drivers/.gitignore
vendored
|
@ -1 +1 @@
|
|||
mysql-connector-java-3.0.7-stable-bin.jar
|
||||
mysql-connector-*.jar
|
||||
|
|
|
@ -86,6 +86,22 @@ class IndexDirectoryImpl extends Directory
|
|||
|
||||
} // end release
|
||||
|
||||
public boolean isLocked()
|
||||
{
|
||||
try
|
||||
{ // call through to the database
|
||||
return m_ops.queryLock(m_ndx,m_name);
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException e)
|
||||
{ // turn it into an I/O exception
|
||||
logger.warn("IndexDirectoryImpl.MyLock.isLocked(): failed operation",e);
|
||||
return false;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end isLocked
|
||||
|
||||
} // end class MyLock
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
|
|
@ -64,6 +64,8 @@ abstract class IndexOps extends OpsBase
|
|||
|
||||
abstract void releaseLock(int ndx, String lock) throws DatabaseException;
|
||||
|
||||
abstract boolean queryLock(int ndx, String lock) throws DatabaseException;
|
||||
|
||||
abstract void releaseAllLocks(int ndx) throws DatabaseException;
|
||||
|
||||
} // end class IndexOps
|
||||
|
|
|
@ -538,6 +538,45 @@ class IndexOps_mysql extends IndexOps
|
|||
|
||||
} // end releaseLock
|
||||
|
||||
boolean queryLock(int ndx, String lock) throws DatabaseException
|
||||
{
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
Statement stmt2 = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{ // get a connection
|
||||
conn = getConnection();
|
||||
|
||||
// lock the table
|
||||
stmt2 = conn.createStatement();
|
||||
stmt2.executeUpdate("LOCK TABLES ndx_locks READ;");
|
||||
|
||||
// see if the lock is present
|
||||
stmt = conn.prepareStatement("SELECT ndxid FROM ndx_locks WHERE ndxid = ? AND name = ?;");
|
||||
stmt.setInt(1,ndx);
|
||||
stmt.setString(2,lock);
|
||||
rs = stmt.executeQuery();
|
||||
return rs.next(); // present if true
|
||||
|
||||
} // end try
|
||||
catch (SQLException e)
|
||||
{ // translate to a general DatabaseException
|
||||
throw generalException(e);
|
||||
|
||||
} // end catch
|
||||
finally
|
||||
{ // shut everything down
|
||||
MySQLUtils.unlockTables(conn);
|
||||
SQLUtils.shutdown(rs);
|
||||
SQLUtils.shutdown(stmt);
|
||||
SQLUtils.shutdown(stmt2);
|
||||
SQLUtils.shutdown(conn);
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end queryLock
|
||||
|
||||
void releaseAllLocks(int ndx) throws DatabaseException
|
||||
{
|
||||
Connection conn = null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user