[Design of JBossCache] - Re: Ordering of Synchronizations between JBC and Hibernate
by bstansberry@jboss.com
+1 that the suggested changes to JTA are good. But, not likely to happen in time for AS 4.2, so... ;-)
TransactionSynchronizationRegistry.put/getResource could *possibly* be used to communicate information between Hibernate and JBC. But in any case, it's a JEE 5 feature and JBC as a 2nd level cache needs to work in legacy environments.
Synchronization ordering a la what JBC does should be possible, although ugly. Please have a look at class org.jboss.cache.interceptors.OrderedSynchronizationHandler to get a better feel for how JBC does this. Basically, any time JBC wants to add a Synchronization, it:
1) Calls the static OSH.getInstance(Transaction) method.
2) OSH looks up the tx in a Map<Transaction, OSH>; if an instance is found it's returned; if not one is created, put in the map and returned.
3) JBC adds the new Synchronization either at the head or the tail.
4) In the afterCompletion() callback, the entry for the tx is removed from the map.
A solution to the ordering problem would be:
1) Hibernate creates it's own version of OSH. Called here HOSH, with the JBC version now called JOSH.
2) When Hibernate registers synchronizations, it follows the same process as above, using HOSH.
3) TreeCache/OptimisiticTreeCache provide the integration. When a call is invoked with a transactional context, they:
a) Call HOSH.getInstance(tx).
b) Call JOSH.getInstance(tx).
c) Add the JOSH at the tail of the HOSH.
Effect of this is that all JBC synchronizations will execute after any Hibernate synchronizations that were already added to HOSH. *Assuming* the required Hibernate synchronizations are added before the first call to TreeCache/OptimisticTreeCache, this should work.
One thing I haven't given much thought to is any possible classloader issues.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993557#3993557
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993557
19 years, 3 months
[Design of JBoss ESB] - Re: Configuration - normalization
by tfennelly
"mark.little(a)jboss.com" wrote : Configuration duplication leads to errors. Can we take an approach that reduces that?
I think that's what we're trying to do :-) We're just trying to find a balance here.
My point would be 2-fold in that you will always have duplication of one sort or another...
if not normalised enough - excessive duplication of the actual config params
if normalised to the nth degree - excessive duplication of reference id's etc, without a system to manage this referential integrity (unlike a DB eg).
... adding to that the fact that normalisation to the nth degree will definitely lead to fragmentation of the config on a grand scale => difficult to comprehend (perhaps not for all people ;-) ).
So sure, we want to reduce errors caused by duplication, but surely we don't want to introduce another family of errors :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993554#3993554
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993554
19 years, 3 months
[Design of JBossCache] - Ordering of Synchronizations between JBC and Hibernate
by bstansberry@jboss.com
Continuation of discussion started at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=95058.
This takes on new urgency due to the use of JBossTS in AS 4.2 (http://jira.jboss.com/jira/browse/JBAS-3892). I hadn't realized that was the plan until today. Basically, we need to come up with a solution for this in a matter of weeks. A solution most likely involves either a new JBC release or a new Hibernate release.
I'll paste some earlier comments included in a discussion on the jbosscache-dev list:
"Brian Stansberry" wrote :
| Anyone have any good thoughts on what to do about it? Perhaps Hibernate exposes something like JBC's OrderedSynchronizationHandler, which the JBC integration can use to insert it's synchronization at the correct point?
|
"Manik Surtani" wrote : Not sure, cc'ing Hibernate-all. Even if there was such an ordered sync handler, we'd have to expose a mechanism to have this injected. Perhaps via the Runtime.
"Emmanuel Bernard" wrote :
| No, not possible right now.
|
| This problem roots to JTA, we really should push the ability to:
| 1. guaranty synchronization ordering
| 2. query/alter the synchronization list
| in a standard way.
|
| 1. is not possible today and
| javax/transaction/TransactionSynchronizationRegistry is way too limited 2. is useful when writing frameworks on top of JavaEE as a way to keep state / avoid multiple synchronization on a per transaction basis.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993541#3993541
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993541
19 years, 3 months