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 2010/07/08 15:46:10 UTC
svn commit: r961767 - in
/camel/trunk/camel-core/src/main/java/org/apache/camel:
impl/DefaultDebugger.java spi/Debugger.java
Author: davsclaus
Date: Thu Jul 8 13:46:09 2010
New Revision: 961767
URL: http://svn.apache.org/viewvc?rev=961767&view=rev
Log:
CAMEL-2919: only one single step at a given time is allowed.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Debugger.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java?rev=961767&r1=961766&r2=961767&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java Thu Jul 8 13:46:09 2010
@@ -52,8 +52,8 @@ public class DefaultDebugger implements
private static final Log LOG = LogFactory.getLog(DefaultDebugger.class);
private final List<BreakpointConditions> breakpoints = new ArrayList<BreakpointConditions>();
- // TODO: Should we support multiple single steps?
- private final Map<String, Breakpoint> singleSteps = new HashMap<String, Breakpoint>();
+ private final int maxConcurrentSingleSteps = 1;
+ private final Map<String, Breakpoint> singleSteps = new HashMap<String, Breakpoint>(maxConcurrentSingleSteps);
private CamelContext camelContext;
/**
@@ -97,11 +97,11 @@ public class DefaultDebugger implements
}
public void addBreakpoint(Breakpoint breakpoint) {
- breakpoints.add(new BreakpointConditions(breakpoint));
+ addBreakpoint(breakpoint, (Condition) null);
}
public void addBreakpoint(Breakpoint breakpoint, Condition... conditions) {
- if (conditions != null) {
+ if (conditions != null && conditions.length > 0) {
breakpoints.add(new BreakpointConditions(breakpoint, Arrays.asList(conditions)));
} else {
breakpoints.add(new BreakpointConditions(breakpoint));
@@ -109,7 +109,7 @@ public class DefaultDebugger implements
}
public void addSingleStepBreakpoint(final Breakpoint breakpoint) {
- addSingleStepBreakpoint(breakpoint, null);
+ breakpoints.add(new BreakpointConditions(breakpoint));
}
public void addSingleStepBreakpoint(final Breakpoint breakpoint, Condition... conditions) {
@@ -177,8 +177,14 @@ public class DefaultDebugger implements
return Collections.unmodifiableList(answer);
}
- public void startSingleStepExchange(String exchangeId, Breakpoint breakpoint) {
+ public boolean startSingleStepExchange(String exchangeId, Breakpoint breakpoint) {
+ // can we accept single stepping the given exchange?
+ if (singleSteps.size() >= maxConcurrentSingleSteps) {
+ return false;
+ }
+
singleSteps.put(exchangeId, breakpoint);
+ return true;
}
public void stopSingleStepExchange(String exchangeId) {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Debugger.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Debugger.java?rev=961767&r1=961766&r2=961767&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Debugger.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Debugger.java Thu Jul 8 13:46:09 2010
@@ -96,8 +96,10 @@ public interface Debugger extends Servic
*
* @param exchangeId the exchange id
* @param breakpoint the breakpoint
+ * @return <tt>true</tt> if the debugger will single step the given exchange, <tt>false</tt> if the debugger is already
+ * single stepping another, and thus cannot simultaneously single step another exchange
*/
- void startSingleStepExchange(String exchangeId, Breakpoint breakpoint);
+ boolean startSingleStepExchange(String exchangeId, Breakpoint breakpoint);
/**
* Stops the single step debug mode for the given exchange.