Hi,
I have an application on very beefy hardware, which for better or
worse, has a gigantic number of derby databases it has to open on
startup. I have some multi-threaded code which opens the databases in
parallel, but I have found many of the threads are stuck in one or two
states as seen below:
Is there any way this contention can be avoided? In this situation,
it can take an hour to open all the databases due to the serialisation
that is present. Any advice would be highly appreciated.
Cheers,
David
java.lang.Thread.State: BLOCKED (on object monitor)
at
org.apache.derby.impl.services.monitor.BaseMonitor.findTopService(BaseMonitor.java:541)
- waiting to lock <0x00000001507f61a0> (a
org.apache.derby.impl.services.monitor.FileMonitor)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:529)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:427)
at org.apache.derby.impl.store.raw.RawStore.boot(RawStore.java:190)
at
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:531)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:427)
at
org.apache.derby.impl.store.access.RAMAccessManager.boot(RAMAccessManager.java:1019)
at
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:531)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:427)
at
org.apache.derby.impl.db.BasicDatabase.bootStore(BasicDatabase.java:749)
at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:177)
at
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
at
org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1816)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1682)
at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1509)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:979)
at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:550)
at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2697)
at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:385)
at
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
at
org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:51)
at
org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:70)
at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:248)
at
org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:480)
at
org.apache.derby.jdbc.EmbedPooledConnection.openRealConnection(EmbedPooledConnection.java:178)
at
org.apache.derby.jdbc.EmbedPooledConnection.<init>(EmbedPooledConnection.java:119)
at
org.apache.derby.jdbc.EmbedPooledConnection40.<init>(EmbedPooledConnection40.java:54)
at
org.apache.derby.jdbc.Driver40.getNewPooledConnection(Driver40.java:178)
at
org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.createPooledConnection(EmbeddedConnectionPoolDataSource.java:129)
at
org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.getPooledConnection(EmbeddedConnectionPoolDataSource.java:75)
...
and here is another example:
java.lang.Thread.State: BLOCKED (on object monitor)
at
org.apache.derby.impl.services.monitor.FileMonitor.getJVMProperty(FileMonitor.java:218)
- waiting to lock <0x00000001507f61a0> (a
org.apache.derby.impl.services.monitor.FileMonitor)
at
org.apache.derby.iapi.services.property.PropertyUtil.getServiceProperty(PropertyUtil.java:304)
at
org.apache.derby.iapi.services.property.PropertyUtil.getServiceProperty(PropertyUtil.java:333)
at
org.apache.derby.iapi.services.property.PropertyUtil.getServiceBoolean(PropertyUtil.java:374)
at
org.apache.derby.impl.store.access.RllRAMAccessManager.bootLookupSystemLockLevel(RllRAMAccessManager.java:99)
at
org.apache.derby.impl.store.access.RAMAccessManager.boot(RAMAccessManager.java:1158)
at
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(BaseMonitor.java:531)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Monitor.java:427)
at
org.apache.derby.impl.db.BasicDatabase.bootStore(BasicDatabase.java:749)
at org.apache.derby.impl.db.BasicDatabase.boot(BasicDatabase.java:177)
at
org.apache.derby.impl.services.monitor.BaseMonitor.boot(BaseMonitor.java:1982)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(TopService.java:334)
at
org.apache.derby.impl.services.monitor.BaseMonitor.bootService(BaseMonitor.java:1816)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(BaseMonitor.java:1682)
at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(BaseMonitor.java:1509)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(BaseMonitor.java:979)
at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Monitor.java:550)
at
org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(EmbedConnection.java:2697)
at
org.apache.derby.impl.jdbc.EmbedConnection.<init>(EmbedConnection.java:385)
at
org.apache.derby.impl.jdbc.EmbedConnection30.<init>(EmbedConnection30.java:73)
at
org.apache.derby.impl.jdbc.EmbedConnection40.<init>(EmbedConnection40.java:51)
at
org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Driver40.java:70)
at org.apache.derby.jdbc.InternalDriver.connect(InternalDriver.java:248)
at
org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:480)
at
org.apache.derby.jdbc.EmbedPooledConnection.openRealConnection(EmbedPooledConnection.java:178)
at
org.apache.derby.jdbc.EmbedPooledConnection.<init>(EmbedPooledConnection.java:119)
at
org.apache.derby.jdbc.EmbedPooledConnection40.<init>(EmbedPooledConnection40.java:54)
at
org.apache.derby.jdbc.Driver40.getNewPooledConnection(Driver40.java:178)
at
org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.createPooledConnection(EmbeddedConnectionPoolDataSource.java:129)
at
org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.getPooledConnection(EmbeddedConnectionPoolDataSource.java:75)
...