db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Warrick <philip.warr...@mcgill.ca>
Subject ODMG patch: per-transaction implicit locking
Date Thu, 02 Oct 2003 03:04:47 GMT

I have been using the following patch to control the implicit locking 
flag at the transaction level (instead of a single global setting).  I 
developed it because I wanted to do ODMG reading without implicit 
locking and to do ODMG writing with implicit locking.  Even with a 
schema that is fully proxied, I found that read locking propagates 
across the proxies leading to a potentially large graph traversal.

The changes are really just the addition of a 
setImplicitLocking(boolean) method to the following three classes:


This has been tested in both a single JVM setting and in a J2EE/EJB 

The changes (below) are so trivial that I didn't do make a true patch 
file.  I hope one of the developers can review these changes and 
incorporate them if appropriate.

This change can be thought of as an extension to the ODMG api, giving 
greater control to the locking stategy (the ODMG standard enforces no
particular implicit locking strategy).  The global setting 
"ImplicitLocking" specified in OJB.properties is used when a 
org.apache.ojb.odmg.TransactionImpl is created.  A subsequent call to 
OJB#setImplicitLocking(boolean) or
OJBJ2EE_2#setImplicitLocking(boolean) within the transaction overrides 
the global setting.

The reason that I did not use the approach

to set the global configuration setting is that this is not thread-safe, 
as far as I can tell.

Of course if there's an easier way to do this I'd like to know.


1) org.apache.ojb.odmg.TransactionImpl.java
public void setImplicitLocking(boolean in)
useImplicitLocking = in;

2) org.apache.ojb.odmg.OJB.java
public void setImplicitLocking(boolean in)

3) org.apache.ojb.odmg.OJBJ2EE_2.java
public void setImplicitLocking(boolean in)

To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org

View raw message