as Map key, not the DbSource instance. Using the instance as key is both inefficient and
error prone (see fd0b77bc11).
Additional changes:
- modified getConnection() to check if the DB is oracle. "SELECT 1" is invalid
for Oracle DBs and lead to Helma dropping in-use connections every minute.
- set DbSource name final
The source of the deadlock problem seems that during DbSource.getConnection() ResourceProperties instances are compared using their equals() method, which is synchronized in Hashtable and can/does lead to deadlocks (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6582568).
This commit overwrites equals with an unsynchronized version. Note that this implementation might return a wrong result if one of the two instances is modified during this method call, but at least doesn't throw a ConcurrentModificationException.
the statistics of a cache instance for an application can be retrieved
by calling `app.__app__.getCacheStatistics()`. That's not very useful for the
default `ObjectCache` but essential for looking into what more complex cache
impls like `SwarmCache` do
we could remove all the other cache statistics methods like `getCacheUsage`
and output that info in the map returned by `getCacheStatistics()`
i had to bump java to 1.5 for the generics.. if that's a problem we can
remove the generics
one of our apps was stuck in a deadlock in ResourceProperties.size(),
see excerpt of the stack trace below. this fix synchronizes various overriding
methods since they are synchronized in Hashtable as well.
removed superfluous toString method too.
```
"app-230":
at java.util.Hashtable.size(Hashtable.java:206)
- waiting to lock <0xa13f8548> (a helma.util.ResourceProperties)
at helma.util.ResourceProperties.size(ResourceProperties.java:529)
at java.util.Hashtable.equals(Hashtable.java:742)
- locked <0xa1065708> (a helma.util.ResourceProperties)
at helma.objectmodel.db.DbSource.equals(DbSource.java:292)
...
"app-439":
at java.util.Hashtable.size(Hashtable.java:206)
- waiting to lock <0xa1065708> (a helma.util.ResourceProperties)
at helma.util.ResourceProperties.size(ResourceProperties.java:529)
at java.util.Hashtable.equals(Hashtable.java:742)
- locked <0xa13f8548> (a helma.util.ResourceProperties)
at helma.objectmodel.db.DbSource.equals(DbSource.java:292)
...
```