From: <tho...@us...> - 2011-05-06 12:59:14
|
Revision: 4458 http://bigdata.svn.sourceforge.net/bigdata/?rev=4458&view=rev Author: thompsonbry Date: 2011-05-06 12:59:07 +0000 (Fri, 06 May 2011) Log Message: ----------- Added check to BigdataSail#getUnisolatedConnection(). If the caller already holds the unisolated connection, this method will now throw an IllegalStateException. This provides an early warning of the most common means by which an application had been able to obtain multiple "unisolated" connections. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java 2011-05-06 12:58:25 UTC (rev 4457) +++ branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java 2011-05-06 12:59:07 UTC (rev 4458) @@ -1301,7 +1301,17 @@ public BigdataSailConnection getUnisolatedConnection() throws InterruptedException { - if (getDatabase().getIndexManager() instanceof Journal) { + if(lock.writeLock().isHeldByCurrentThread()) { + /* + * A thread which already holds this lock already has the open + * unisolated connection and will deadlock when it attempts to + * obtain the permit for that connection from the Journal. + */ + throw new IllegalStateException( + "UNISOLATED connection is not reentrant."); + } + + if (getDatabase().getIndexManager() instanceof Journal) { // acquire permit from Journal. ((Journal) getDatabase().getIndexManager()) .acquireUnisolatedConnection(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |