001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel.spi; 018 019 import java.util.List; 020 021 import org.apache.camel.RouteNode; 022 import org.apache.camel.model.ProcessorDefinition; 023 024 /** 025 * A Unit of work that is also traceable with the 026 * {@link org.apache.camel.processor.interceptor.TraceInterceptor} so we can trace the excact 027 * route path a given {@link org.apache.camel.Exchange} has been processed. 028 * 029 * @version $Revision: 788766 $ 030 */ 031 public interface TraceableUnitOfWork extends UnitOfWork { 032 033 /** 034 * Adds the entry that was intercepted 035 * 036 * @param entry the entry 037 */ 038 void addTraced(RouteNode entry); 039 040 /** 041 * Gets the last node, is <tt>null</tt> if no last exists. 042 */ 043 RouteNode getLastNode(); 044 045 /** 046 * Gets the 2nd last node, is <tt>null</tt> if no last exists. 047 */ 048 RouteNode getSecondLastNode(); 049 050 /** 051 * Gets the current list of nodes, representing the route path the 052 * current {@link org.apache.camel.Exchange} has currently taken. 053 */ 054 List<RouteNode> getNodes(); 055 056 /** 057 * A private counter that increments, is used to as book keeping how far this 058 * exchange have been intercepted by the general intercept(). 059 * <p/> 060 * We need this special book keeping to keep correct order when dealing 061 * with concurrent exchanges being routed in the same route path. 062 * 063 * @param node the intercept node 064 * @return the current count 065 */ 066 int getAndIncrement(ProcessorDefinition node); 067 068 }