You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/03/01 07:37:54 UTC
[camel] branch master updated (fff69f5 -> fc4b5bb)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from fff69f5 Fixed CS for camel-core
new 497f071 Adding more details in trace logging for service lifecycle
new fc4b5bb CAMEL-13243: Spring Main supports Spring IoC for route builder classes.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../main/java/org/apache/camel/spring/Main.java | 4 +-
.../camel/support/service/ServiceSupport.java | 56 +++++++++++-----------
.../apache/camel/support/ChildServiceSupport.java | 30 ++++++------
3 files changed, 44 insertions(+), 46 deletions(-)
[camel] 01/02: Adding more details in trace logging for service
lifecycle
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 497f07195b78ed05101a654f51e5ef11c22822e8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 1 07:36:59 2019 +0100
Adding more details in trace logging for service lifecycle
---
.../camel/support/service/ServiceSupport.java | 56 +++++++++++-----------
.../apache/camel/support/ChildServiceSupport.java | 30 ++++++------
2 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java b/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
index 5644bb1..126c319 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/service/ServiceSupport.java
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
* <p/>
* <b>Important: </b> You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()}},
* {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
- * <b>NOT</b> be overriden as they are used internally to keep track of the state of this service and properly
+ * <b>NOT</b> be overridden as they are used internally to keep track of the state of this service and properly
* invoke the operation in a safe manner.
*/
public abstract class ServiceSupport implements StatefulService {
@@ -55,7 +55,7 @@ public abstract class ServiceSupport implements StatefulService {
if (status == NEW) {
synchronized (lock) {
if (status == NEW) {
- log.trace("Initializing service");
+ log.trace("Initializing service: {}", this);
doInit();
status = INITIALIZED;
}
@@ -72,23 +72,23 @@ public abstract class ServiceSupport implements StatefulService {
public void start() throws Exception {
synchronized (lock) {
if (status == STARTED) {
- log.trace("Service already started");
+ log.trace("Service: {} already started", this);
return;
}
if (status == STARTING) {
- log.trace("Service already starting");
+ log.trace("Service: {} already starting", this);
return;
}
init();
try {
status = STARTING;
- log.trace("Starting service");
+ log.trace("Starting service: {}", this);
doStart();
status = STARTED;
- log.trace("Service started");
+ log.trace("Service started: {}", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while starting service", e);
+ log.trace("Error while starting service: " + this, e);
throw e;
}
}
@@ -97,28 +97,28 @@ public abstract class ServiceSupport implements StatefulService {
/**
* <b>Important: </b> You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
* {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
- * <b>NOT</b> be overriden as they are used internally to keep track of the state of this service and properly
+ * <b>NOT</b> be overridden as they are used internally to keep track of the state of this service and properly
* invoke the operation in a safe manner.
*/
public void stop() throws Exception {
synchronized (lock) {
if (status == STOPPED || status == SHUTTINGDOWN || status == SHUTDOWN) {
- log.trace("Service already stopped");
+ log.trace("Service: {} already stopped", this);
return;
}
if (status == STOPPING) {
- log.trace("Service already stopping");
+ log.trace("Service: {} already stopping", this);
return;
}
status = STOPPING;
- log.trace("Stopping service");
+ log.trace("Stopping service: {}", this);
try {
doStop();
status = STOPPED;
- log.trace("Service stopped service");
+ log.trace("Service: {} stopped service", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while stopping service", e);
+ log.trace("Error while stopping service: " + this, e);
throw e;
}
}
@@ -127,29 +127,29 @@ public abstract class ServiceSupport implements StatefulService {
/**
* <b>Important: </b> You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
* {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
- * <b>NOT</b> be overriden as they are used internally to keep track of the state of this service and properly
+ * <b>NOT</b> be overridden as they are used internally to keep track of the state of this service and properly
* invoke the operation in a safe manner.
*/
@Override
public void suspend() throws Exception {
synchronized (lock) {
if (status == SUSPENDED) {
- log.trace("Service already suspended");
+ log.trace("Service: {} already suspended", this);
return;
}
if (status == SUSPENDING) {
- log.trace("Service already suspending");
+ log.trace("Service: {} already suspending", this);
return;
}
status = SUSPENDING;
- log.trace("Suspending service");
+ log.trace("Suspending service: {}", this);
try {
doSuspend();
status = SUSPENDED;
- log.trace("Service suspended");
+ log.trace("Service suspended: {}", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while suspending service", e);
+ log.trace("Error while suspending service: " + this, e);
throw e;
}
}
@@ -165,18 +165,18 @@ public abstract class ServiceSupport implements StatefulService {
public void resume() throws Exception {
synchronized (lock) {
if (status != SUSPENDED) {
- log.trace("Service is not suspended");
+ log.trace("Service is not suspended: {}", this);
return;
}
status = STARTING;
- log.trace("Resuming service");
+ log.trace("Resuming service: {}", this);
try {
doResume();
status = STARTED;
- log.trace("Service resumed");
+ log.trace("Service resumed: {}", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while resuming service", e);
+ log.trace("Error while resuming service: " + this, e);
throw e;
}
}
@@ -192,23 +192,23 @@ public abstract class ServiceSupport implements StatefulService {
public void shutdown() throws Exception {
synchronized (lock) {
if (status == SHUTDOWN) {
- log.trace("Service already shut down");
+ log.trace("Service: {} already shut down", this);
return;
}
if (status == SHUTTINGDOWN) {
- log.trace("Service already shutting down");
+ log.trace("Service: {} already shutting down", this);
return;
}
stop();
status = SHUTDOWN;
- log.trace("Shutting down service");
+ log.trace("Shutting down service: {}", this);
try {
doShutdown();
- log.trace("Service shut down");
+ log.trace("Service: {} shut down", this);
status = SHUTDOWN;
} catch (Exception e) {
status = FAILED;
- log.trace("Error shutting down service", e);
+ log.trace("Error shutting down service: " + this, e);
throw e;
}
}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/ChildServiceSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/ChildServiceSupport.java
index 16ac142..6817d14 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/ChildServiceSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/ChildServiceSupport.java
@@ -33,23 +33,23 @@ public abstract class ChildServiceSupport extends ServiceSupport {
public void start() throws Exception {
synchronized (lock) {
if (status == STARTED) {
- log.trace("Service already started");
+ log.trace("Service: {} already started", this);
return;
}
if (status == STARTING) {
- log.trace("Service already starting");
+ log.trace("Service: {} already starting", this);
return;
}
status = STARTING;
- log.trace("Starting service");
+ log.trace("Starting service: {}", this);
try {
ServiceHelper.startService(childServices);
doStart();
status = STARTED;
- log.trace("Service started");
+ log.trace("Service: {} started", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while starting service", e);
+ log.trace("Error while starting service: " + this, e);
ServiceHelper.stopService(childServices);
throw e;
}
@@ -59,23 +59,23 @@ public abstract class ChildServiceSupport extends ServiceSupport {
public void stop() throws Exception {
synchronized (lock) {
if (status == STOPPED || status == SHUTTINGDOWN || status == SHUTDOWN) {
- log.trace("Service already stopped");
+ log.trace("Service: {} already stopped", this);
return;
}
if (status == STOPPING) {
- log.trace("Service already stopping");
+ log.trace("Service: {} already stopping", this);
return;
}
status = STOPPING;
- log.trace("Stopping service");
+ log.trace("Stopping service: {}", this);
try {
doStop();
ServiceHelper.stopService(childServices);
status = STOPPED;
- log.trace("Service stopped service");
+ log.trace("Service: {} stopped service", this);
} catch (Exception e) {
status = FAILED;
- log.trace("Error while stopping service", e);
+ log.trace("Error while stopping service: " + this, e);
throw e;
}
}
@@ -85,24 +85,24 @@ public abstract class ChildServiceSupport extends ServiceSupport {
public void shutdown() throws Exception {
synchronized (lock) {
if (status == SHUTDOWN) {
- log.trace("Service already shut down");
+ log.trace("Service: {} already shut down", this);
return;
}
if (status == SHUTTINGDOWN) {
- log.trace("Service already shutting down");
+ log.trace("Service: {} already shutting down", this);
return;
}
stop();
status = SHUTDOWN;
- log.trace("Shutting down service");
+ log.trace("Shutting down service: {}", this);
try {
doShutdown();
ServiceHelper.stopAndShutdownServices(childServices);
- log.trace("Service shut down");
+ log.trace("Service: {} shut down", this);
status = SHUTDOWN;
} catch (Exception e) {
status = FAILED;
- log.trace("Error shutting down service", e);
+ log.trace("Error shutting down service: " + this, e);
throw e;
}
}
[camel] 02/02: CAMEL-13243: Spring Main supports Spring IoC for
route builder classes.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit fc4b5bbcaec2ca2ce2c6a59943a0c5c58cd09456
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Mar 1 08:37:30 2019 +0100
CAMEL-13243: Spring Main supports Spring IoC for route builder classes.
---
.../camel-spring/src/main/java/org/apache/camel/spring/Main.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
index d729aab..daefa3f 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
@@ -22,7 +22,6 @@ import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Enumeration;
-import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
@@ -31,7 +30,6 @@ import java.util.Set;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
@@ -246,7 +244,7 @@ public class Main extends org.apache.camel.main.MainSupport {
ac.refresh();
return ac;
} else {
- return new ClassPathXmlApplicationContext();
+ return new ClassPathXmlApplicationContext(args);
}
}
}