Shutting down in-memory Derby gracefully

2012-01-12 Thread Pavel Bortnovskiy
Hello, all:

While our application is shutting down, it is possible that some of its 
components may continue execution or even begin execution of the queries on the 
in-memory Derby DB. In such situation, Derby starts throwing all kinds of 
exceptions, including a Null Pointer Exception (pls see excerpt from our log 
below). Is it possible to have Derby shut down more gracefully, so that the 
application doesn't pester our error log files with these exceptions?

Of course, I may be able to work around by implementing an atomic reference 
counter, which gets incremented before a query is executed and decremented when 
it's done. And then, upon a request to shut down Derby, wait until that counter 
gets to 0 before sending the shutdown URL. But it seems kludgy to me and I 
would wish for a more elegant way for Derby itself to handle this, as it has 
the intimate knowledge of what's being executed and what's not.

Or, perhaps, you could recommend a better approach?

Thank you.
Pavel.

2012-01-12 16:15:23,224 [main] INFO  Executing Derby Shutdown Command: 
jdbc:derby:memory:geni;drop=true
2012-01-12 16:15:23,230 SQL Exception due to executing statement
java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown Source)
...
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
 Source)
... 13 more
Caused by: java.lang.NullPointerException
at java.util.LinkedList.remove(LinkedList.java:225)
at 
org.apache.derby.impl.services.locks.LockControl.removeWaiter(Unknown Source)
at 
org.apache.derby.impl.services.locks.LockControl.getNextWaiter(Unknown Source)
at 
org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown 
Source)
at 
org.apache.derby.impl.services.locks.ConcurrentLockSet.zeroDurationLockObject(Unknown
 Source)
at 
org.apache.derby.impl.services.locks.AbstractPool.zeroDurationlockObject(Unknown
 Source)
at 
org.apache.derby.impl.services.locks.ConcurrentPool.zeroDurationlockObject(Unknown
 Source)
at 
org.apache.derby.impl.store.raw.xact.RowLocking2nohold.lockRecordForRead(Unknown
 Source)
at 
org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.lockPositionForRead(Unknown
 Source)
at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchRows(Unknown
 Source)
at 
org.apache.derby.impl.store.access.conglomerate.GenericScanController.fetchSet(Unknown
 Source)
at 
org.apache.derby.impl.store.access.BackingStoreHashTableFromScan.(Unknown 
Source)
at 
org.apache.derby.impl.store.access.RAMTransaction.createBackingStoreHashtableFromScan(Unknown
 Source)
at org.apache.derby.impl.sql.execute.HashScanResultSet.openCore(Unknown 
Source)
at org.apache.derby.impl.sql.execute.JoinResultSet.openRight(Unknown 
Source)
at org.apache.derby.impl.sql.execute.JoinResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.GroupedAggregateResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.openCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.open(Unknown Source)
at 
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
Source)
... 6 more
2012-01-12 16:15:23,231 SQL Exception due to executing statement
java.sql.SQLNonTransientConnectionException: Database 'memory:geni' shutdown.
at 
org.apache.derby.impl.j

Re: source code for 10.0.2.1

2012-01-12 Thread Rick Hillegas

On 1/12/12 1:34 AM, Udhayakumar wrote:


Hi,

I want to download the source code of derby.jar version 
10.0.201 but I'm not able to find the release for the same version 
in apache derby site. Where can I find the source code for that and 
also I wanted to know whether the versions 10.0.21 is same as 
10.0.2.1 .


Thanks,

Udhayakumar N.


Hi Udhayakumar,

The source code for 10.0.2.1 can be found at the following subversion 
tag: https://svn.apache.org/repos/asf/db/derby/code/tags/10.0.2.1/


Hope this helps,
-Rick


[no subject]

2012-01-12 Thread Udhayakumar
Hi,

I want to download the source code of derby.jar version
10.0.201 but I'm not able to find the release for the same version in
apache derby site. Where can I find the source code for that and also I
wanted to know whether the versions 10.0.21 is same as 10.0.2.1 .

 

Thanks,

Udhayakumar N.