1 /* 2 * Copyright 2017, OpenCensus Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.opencensus.trace; 18 19 import io.opencensus.common.Clock; 20 import io.opencensus.impl.internal.DisruptorEventQueue; 21 import io.opencensus.impl.trace.internal.ThreadLocalRandomHandler; 22 import io.opencensus.implcore.common.MillisClock; 23 import io.opencensus.implcore.trace.TraceComponentImplBase; 24 import io.opencensus.trace.config.TraceConfig; 25 import io.opencensus.trace.export.ExportComponent; 26 import io.opencensus.trace.propagation.PropagationComponent; 27 28 /** Java 7 and 8 implementation of the {@link TraceComponent}. */ 29 // TraceComponentImpl was moved to io.opencensus.impl.trace. This class exists for backwards 30 // compatibility, so that it can be loaded by opencensus-api 0.5. 31 @Deprecated 32 public final class TraceComponentImpl extends TraceComponent { 33 private final TraceComponentImplBase traceComponentImplBase; 34 35 /** Public constructor to be used with reflection loading. */ TraceComponentImpl()36 public TraceComponentImpl() { 37 traceComponentImplBase = 38 new TraceComponentImplBase( 39 MillisClock.getInstance(), 40 new ThreadLocalRandomHandler(), 41 DisruptorEventQueue.getInstance()); 42 } 43 44 @Override getTracer()45 public Tracer getTracer() { 46 return traceComponentImplBase.getTracer(); 47 } 48 49 @Override getPropagationComponent()50 public PropagationComponent getPropagationComponent() { 51 return traceComponentImplBase.getPropagationComponent(); 52 } 53 54 @Override getClock()55 public Clock getClock() { 56 return traceComponentImplBase.getClock(); 57 } 58 59 @Override getExportComponent()60 public ExportComponent getExportComponent() { 61 return traceComponentImplBase.getExportComponent(); 62 } 63 64 @Override getTraceConfig()65 public TraceConfig getTraceConfig() { 66 return traceComponentImplBase.getTraceConfig(); 67 } 68 } 69