use of org.apache.camel.spi.Breakpoint in project camel by apache.
the class DefaultDebugger method addSingleStepBreakpoint.
@Override
public void addSingleStepBreakpoint(final Breakpoint breakpoint, Condition... conditions) {
// wrap the breakpoint into single step breakpoint so we can automatic enable/disable the single step mode
Breakpoint singlestep = new Breakpoint() {
@Override
public State getState() {
return breakpoint.getState();
}
@Override
public void suspend() {
breakpoint.suspend();
}
@Override
public void activate() {
breakpoint.activate();
}
@Override
public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
breakpoint.beforeProcess(exchange, processor, definition);
}
@Override
public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
breakpoint.afterProcess(exchange, processor, definition, timeTaken);
}
@Override
public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
if (event instanceof ExchangeCreatedEvent) {
exchange.getContext().getDebugger().startSingleStepExchange(exchange.getExchangeId(), this);
} else if (event instanceof ExchangeCompletedEvent) {
exchange.getContext().getDebugger().stopSingleStepExchange(exchange.getExchangeId());
}
breakpoint.onEvent(exchange, event, definition);
}
@Override
public String toString() {
return breakpoint.toString();
}
};
addBreakpoint(singlestep, conditions);
}
Aggregations