1 // Copyright 2008 The Apache Software Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package org.apache.tapestry5.ioc;
16
17 import org.apache.tapestry5.ioc.internal.util.Invokable;
18
19 /**
20 * Used to track some set of operations in such a way that a failure (a thrown RuntimeException) will be logged along
21 * with a trace of the stack of operations.
22 */
23 public interface OperationTracker
24 {
25 /**
26 * Executes the operation.
27 *
28 * @param description used if there is an exception
29 * @param operation to execute
30 */
31 void run(String description, Runnable operation);
32
33 /**
34 * Executes the operation, returning its value.
35 *
36 * @param description used if there is an exception
37 * @param operation to invoke
38 * @return result of operation
39 */
40 <T> T invoke(String description, Invokable<T> operation);
41 }