This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build: NetBeans IDE Dev (Build 201203180400) VM: Java HotSpot(TM) 64-Bit Server VM, 20.5-b03, Java(TM) SE Runtime Environment, 1.6.0_30-b12 OS: Linux User Comments: pragalathan: SQL query editor is opened and I was about to execute an SQL Stacktrace: java.lang.Throwable: Locked by: at org.openide.filesystems.FileLock.<init>(FileLock.java:85) at org.openide.filesystems.MultiFileObject$MfLock.<init>(MultiFileObject.java:1681) at org.openide.filesystems.MultiFileObject.lock(MultiFileObject.java:712) at org.openide.filesystems.FileObject.getOutputStream(FileObject.java:732) at org.netbeans.modules.db.sql.history.SQLHistoryManager.save(SQLHistoryManager.java:155) at org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:153)
Created attachment 116851 [details] stacktrace
This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=186000
Created attachment 120934 [details] proposed patch v1 The attached patch moves saving into a seperate task that is invoked with a delay of 5 seconds. As save is called anytime an sql is executed, this should save some performance. The task implicitly serializes saving and so locking problems should be minimized. To prevent data loss on jvm shutdown a shutdown hook is added, that checks whether there are unsave changes and flushes these out.
Created attachment 121356 [details] stacktrace Clicked on View Data in the DB table context menu.
Thank you very much. Great job, Matthias. I've only slightly modified the test case, because Thread.sleep can cause problems when the tests are run on a Hudson builder. Integrated as http://hg.netbeans.org/core-main/rev/13832fcf1769
Integrated into 'main-golden', will be available in build *201209250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/13832fcf1769 User: Jaroslav Havlin <jhavlin@netbeans.org> Log: #209720: Locked by DB IO Exception