activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r538957 - in /activemq/camel/trunk/camel-bam/src: main/java/org/apache/camel/bam/model/ main/java/org/apache/camel/bam/processor/ test/resources/
Date Thu, 17 May 2007 14:58:50 GMT
Author: jstrachan
Date: Thu May 17 07:58:49 2007
New Revision: 538957

URL: http://svn.apache.org/viewvc?view=rev&rev=538957
Log:
tidy up logging

Modified:
    activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java
    activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
    activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
    activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java
    activemq/camel/trunk/camel-bam/src/test/resources/log4j.properties

Modified: activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java?view=diff&rev=538957&r1=538956&r2=538957
==============================================================================
--- activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java
(original)
+++ activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java
Thu May 17 07:58:49 2007
@@ -98,8 +98,6 @@
      *         given activity
      */
     public ActivityState getActivityState(ActivityRules activityRules) {
-        log.info("About to iterate through the states: " + getActivityStates());
-
         for (ActivityState activityState : getActivityStates()) {
             if (activityState.isActivity(activityRules)) {
                 return activityState;
@@ -110,14 +108,12 @@
 
     public ActivityState getOrCreateActivityState(ActivityRules activityRules) {
         ActivityState state = getActivityState(activityRules);
-        log.info("Found activity: "+ state);
 
         if (state == null) {
             state = createActivityState();
             state.setProcessInstance(this);
             state.setActivityDefinition(activityRules.getActivityDefinition());
-
-            // TODO not required: getTemplate().persist(state);
+            // we don't need to do: getTemplate().persist(state);
         }
 
         return state;

Modified: activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java?view=diff&rev=538957&r1=538956&r2=538957
==============================================================================
--- activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
(original)
+++ activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
Thu May 17 07:58:49 2007
@@ -36,7 +36,7 @@
 
 /**
  * A timer engine to monitor for expired activities and perform whatever actions are required.
- * 
+ *
  * @version $Revision: $
  */
 public class ActivityMonitorEngine extends ServiceSupport implements Runnable {
@@ -64,7 +64,7 @@
     }
 
     public void run() {
-        log.info("Starting to poll for timeout events");
+        log.debug("Starting to poll for timeout events");
 
         while (!isStopped()) {
             try {
@@ -83,7 +83,9 @@
 
                 long timeToSleep = nextPoll - System.currentTimeMillis();
                 if (timeToSleep > 0) {
-                    log.debug("Sleeping for " + timeToSleep + " millis");
+                    if (log.isDebugEnabled()) {
+                        log.debug("Sleeping for " + timeToSleep + " millis");
+                    }
                     try {
                         Thread.sleep(timeToSleep);
                     }
@@ -99,7 +101,9 @@
     }
 
     protected void fireExpiredEvent(final ActivityState activityState) {
-        log.info("Trying to fire expiration of: " + activityState);
+        if (log.isDebugEnabled()) {
+            log.debug("Trying to fire expiration of: " + activityState);
+        }
 
         template.execute(new JpaCallback() {
             public Object doInJpa(EntityManager entityManager) throws PersistenceException
{

Modified: activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java?view=diff&rev=538957&r1=538956&r2=538957
==============================================================================
--- activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
(original)
+++ activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
Thu May 17 07:58:49 2007
@@ -20,15 +20,14 @@
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.bam.processor.NoCorrelationKeyException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.transaction.support.TransactionTemplate;
-import org.springframework.transaction.support.TransactionCallback;
 import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
 
-import java.lang.reflect.Type;
 import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 
 /**
  * A base {@link Processor} for working on
@@ -39,12 +38,10 @@
  */
 public abstract class BamProcessorSupport<T> implements Processor {
     private static final transient Log log = LogFactory.getLog(BamProcessorSupport.class);
-
     private Class<T> entityType;
     private Expression<Exchange> correlationKeyExpression;
     private TransactionTemplate transactionTemplate;
 
-
     protected BamProcessorSupport(TransactionTemplate transactionTemplate, Expression<Exchange>
correlationKeyExpression) {
         this.transactionTemplate = transactionTemplate;
         this.correlationKeyExpression = correlationKeyExpression;
@@ -72,31 +69,25 @@
     }
 
     public void process(final Exchange exchange) {
-        try {
-            Object entity = transactionTemplate.execute(new TransactionCallback() {
-                public Object doInTransaction(TransactionStatus status) {
-                    try {
-                        Object key = getCorrelationKey(exchange);
-
-                        T entity = loadEntity(exchange, key);
+        transactionTemplate.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus status) {
+                try {
+                    Object key = getCorrelationKey(exchange);
 
-                        log.info("Correlation key: " + key + " with entity: " + entity);
+                    T entity = loadEntity(exchange, key);
 
-                        //storeProcessInExchange(exchange, entity);
-                        processEntity(exchange, entity);
-
-                        return entity;
-                    }
-                    catch (Exception e) {
-                        throw new RuntimeCamelException(e);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Correlation key: " + key + " with entity: " + entity);
                     }
-            }});
+                    processEntity(exchange, entity);
 
-            log.info("After transaction process instance is: " + entity);
-        }
-        catch (Throwable e) {
-            log.error("Caught: " + e, e);            
-        }
+                    return entity;
+                }
+                catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+            }
+        });
     }
 
     // Properties
@@ -105,7 +96,6 @@
         return correlationKeyExpression;
     }
 
-
     public Class<T> getEntityType() {
         return entityType;
     }
@@ -115,7 +105,6 @@
     protected abstract void processEntity(Exchange exchange, T entity) throws Exception;
 
     protected abstract T loadEntity(Exchange exchange, Object key);
-
 
     protected Object getCorrelationKey(Exchange exchange) throws NoCorrelationKeyException
{
         Object value = correlationKeyExpression.evaluate(exchange);

Modified: activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java?view=diff&rev=538957&r1=538956&r2=538957
==============================================================================
--- activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java
(original)
+++ activemq/camel/trunk/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java
Thu May 17 07:58:49 2007
@@ -47,7 +47,7 @@
 
     protected void processEntity(Exchange exchange, ProcessInstance process) throws Exception
{
         if (log.isDebugEnabled()) {
-            log.info("Processing process instance: " + process);
+            log.debug("Processing process instance: " + process);
         }
 
         // lets force the lazy creation of this activity

Modified: activemq/camel/trunk/camel-bam/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-bam/src/test/resources/log4j.properties?view=diff&rev=538957&r1=538956&r2=538957
==============================================================================
--- activemq/camel/trunk/camel-bam/src/test/resources/log4j.properties (original)
+++ activemq/camel/trunk/camel-bam/src/test/resources/log4j.properties Thu May 17 07:58:49
2007
@@ -23,6 +23,7 @@
 #log4j.logger.org.apache.activemq=DEBUG
 log4j.logger.org.apache.camel=DEBUG
 log4j.logger.org.springframework=WARN
+log4j.logger.org.hibernate=WARN
 
 # CONSOLE appender not used by default
 log4j.appender.out=org.apache.log4j.ConsoleAppender



Mime
View raw message