View Javadoc

1   package org.e2etrace.trace;
2   
3   /*
4    * Copyright 2006 Gunther Popp
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /**
20   * Trace step id for session root steps.
21   * <p>
22   *
23   * This id is only used by trace session root steps (see
24   * {@link TraceSessionRootStep}). Root ids use a dollar sign ($) as prefix for
25   * the step id. Additonally they memorize the name of the thread that executes
26   * the trace session.
27   * <p>
28   */
29  public class TraceSessionRootStepId extends AbstractTraceStepId {
30  
31    private static final long serialVersionUID = 1L;
32  
33    private String threadName;
34  
35    /**
36     * Constructor.
37     *
38     * @param id ID of the trace session. The constructor adds automatically a
39     *          dollar sign ($) as prefix.
40     */
41    public TraceSessionRootStepId(String id) {
42      super("$" + id);
43      this.threadName = Thread.currentThread().getName();
44    }
45  
46    /**
47     * Returns the name of the thread that executes the trace session.
48     * <p>
49     *
50     * @return the threadName
51     */
52    public String getThreadName() {
53      return this.threadName;
54    }
55  
56  }