Replying to my own message (as I did on the forum - http://www.jboss.org/forums/thread.jsp?nav=false&forum=47&thread=19225&start =0&msRange=15).
cut and paste from the forum for those interested: I've had a look at the code, specificially this (http://www.mail-archive.com/[email protected]/msg2407 4.html) change, and come to the conclusion that a read-only method in a bean makes no difference to the lock _unless_ the entire tx is readonly. example: a.foo() // normal r/w method b.bar() // r/o method a.foo() calls b.bar() b is locked until the tx is finished. is this correct? secondly - assuming it is correct - is it required? Why do we need to lock b for any more than the method call if we know that b does not change in the tx? here is the code (from QueuedPessimisticEJBLock) that leads me to this conclusion: // Promote the txlock into a writeLock if we're not a readonly method // isReadOnlyTxLock will be reset in nextTransaction() Method method = mi.getMethod(); isReadOnlyTxLock = isReadOnlyTxLock && ( ((EntityContainer)container).isReadOnly() || ( method != null && container.getBeanMetaData().isMethodReadOnly(method.getName()) ) ); thanks in advance, cheers dim ----- Original Message ----- From: "Dmitri Colebatch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, August 11, 2002 11:16 AM Subject: [JBoss-user] read-only methods in 3.0.1 > Hi, > > I posted this question on the forums as well: > http://www.jboss.org/forums/thread.jsp?forum=47&thread=19225 > > In essence, I have an entity bean which exposes its abstract getId() CMP > method and want to mark it read-only to avoid deadlocks on the instance. > From memory this is Bill Burke's area, and I found this in the archives: > http://www.mail-archive.com/[email protected]/msg18814.html - > and so I added this to my jboss.xml: > > <entity> > <ejb-name>Page</ejb-name> > <local-jndi-name>Page</local-jndi-name> > <resource-ref> > <res-ref-name>jdbc/DataSource</res-ref-name> > <resource-name>java:/PostgresDS</resource-name> > </resource-ref> > <method-attributes> > <method> > <method-name>getId</method-name> > <read-only>true</read-only> > </method> > </method-attributes> > </entity> > > but it didn't fix the problem - I'm still getting a deadlock when I try to > access getId() - I would have thought this would have fixed it (by allowing > the bean to be locked only for the method call). > > Am I missing something? > > cheers > dim > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This sf.net email is sponsored by: Dice - The leading online job board for high-tech professionals. Search and apply for tech jobs today! http://seeker.dice.com/seeker.epl?rel_code=31 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
