Mattias Bogeblad wrote:

I used to put some logic in the stored method which did castor
cache-refreshes remote and some other logic. It seemed however that the
locks were not released on the entities when "stored" was called so the
application just hung. Is that the right conclusion?

There is no stored() method. If there were such a method it would imply that an object has been persisted (past tense). However, there is a storing() method, implying that an object is currently being persisted (present tense). If you're trying to flush the cache while a tx is in process, yes very bad things could occur. Werner could comment more on cache flushing during a tx. He is more familiar with the caching scheme lately.


It is very important for me to be able to decide if the entity is really
going to be commited or not - is that absolutely decidable in
created/updated? Is the transaction absolutely over when those calls are
made so I don't get a lock problem again?

The created() callback method is called in:

    TransactionContext.update()
    TransactionContext.create()
    TransactionContext.prepare()

and the updated() callback method is called in:

    TransactionContext.markUpdate()

So it seems like this may be what you're looking for, but I'm not fully aware of your situation. Try them out and let us know.

Well the tx is only complete after commit() is called successfuly and TransactionContext._status = Status.STATUS_COMMITTED (this is in the TransactionContext.commit() method on line 1674). Please note that there is also the org.exolab.castor.persist.TxSynchronizable interface. This is a callback interface with two methods: committed() and rolledback(). an impl of this class can be registered using TransactionContext.addTxSynchronizable() and can be deregistered using the TransactionContext.removeTxSynchronizable() methods. This might be more of what you're need. But now that I'm looking at it, I don't see a manner in which to get a handle on the current tx. the only thing I see a method:

    protected TransactionContext DatabaseImpl.getTransaction()

I wonder if this should be made public and exposed via the Database interface? But I'm not sure if this method should be exposed to the user. I'm not sure if the tx should be exposed to the casual user. I believe that the intention of the TxSynchronizable interface was for internal use. I'm just wondering if it's a solution for Matthias.

Committers et al., could you please render some comments on this?


Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\\"F9E<G)E=\\$\\!F<FEI+F-O;0\\`\\`");'


The Castor Project
http://www.castor.org/

Apache Geronimo
http://incubator.apache.org/projects/geronimo.html



----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to