cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darren Shepherd <darren.s.sheph...@gmail.com>
Subject can somebody explain @DB(txn=false)
Date Wed, 04 Sep 2013 16:46:37 GMT
I see @DB(txn=false) a lot in the code.  The javadoc says "By marking 
txn=false the method is not surrounded with transaction code" but I 
can't find any code that backs up this claim.  I only can find the below 
code in com.cloud.utils.db.TransactionContextBuilder that seems to point 
to the fact that only the existence of @DB indicates a transaction.

     @Override
     public boolean needToIntercept(Method method) {
         DB db = method.getAnnotation(DB.class);
         if (db != null) {
             return true;
         }

         Class<?> clazz = method.getDeclaringClass();

         do {
             db = clazz.getAnnotation(DB.class);
             if (db != null) {
                 return true;
             }
             clazz = clazz.getSuperclass();
         } while (clazz != Object.class && clazz != null);

         return false;
     }

I grep'd through the code for ".txn()" and never once found a reference 
to it.  Its is safe to assume the txn attribute on @DB is bogus?

Darren

Mime
View raw message