Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8BA4517544 for ; Thu, 4 Jun 2015 13:07:41 +0000 (UTC) Received: (qmail 8694 invoked by uid 500); 4 Jun 2015 13:07:41 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 8629 invoked by uid 500); 4 Jun 2015 13:07:41 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 8586 invoked by uid 99); 4 Jun 2015 13:07:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2015 13:07:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 34EFFE04DC; Thu, 4 Jun 2015 13:07:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <1c6053e225e04703a17b4f52914115bd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-6360] Moving HTraceTracerContext into a diff package Date: Thu, 4 Jun 2015 13:07:41 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master 38d3b4214 -> c2b70fd46 [CXF-6360] Moving HTraceTracerContext into a diff package Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c2b70fd4 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c2b70fd4 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c2b70fd4 Branch: refs/heads/master Commit: c2b70fd462955b714f0211ff52e1f99399666d44 Parents: 38d3b42 Author: Sergey Beryozkin Authored: Thu Jun 4 14:07:23 2015 +0100 Committer: Sergey Beryozkin Committed: Thu Jun 4 14:07:23 2015 +0100 ---------------------------------------------------------------------- .../tracing/htrace/HTraceContextProvider.java | 1 + .../tracing/htrace/HTraceTracerContext.java | 77 -------------------- .../cxf/tracing/htrace/HTraceTracerContext.java | 77 ++++++++++++++++++++ 3 files changed, 78 insertions(+), 77 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c2b70fd4/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceContextProvider.java ---------------------------------------------------------------------- diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceContextProvider.java b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceContextProvider.java index c983f1d..12abac9 100644 --- a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceContextProvider.java +++ b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceContextProvider.java @@ -23,6 +23,7 @@ import javax.ws.rs.ext.Provider; import org.apache.cxf.jaxrs.ext.ContextProvider; import org.apache.cxf.message.Message; import org.apache.cxf.tracing.TracerContext; +import org.apache.cxf.tracing.htrace.HTraceTracerContext; import org.apache.htrace.Sampler; import org.apache.htrace.impl.NeverSampler; http://git-wip-us.apache.org/repos/asf/cxf/blob/c2b70fd4/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceTracerContext.java ---------------------------------------------------------------------- diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceTracerContext.java b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceTracerContext.java deleted file mode 100644 index 5694795..0000000 --- a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/jaxrs/tracing/htrace/HTraceTracerContext.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.jaxrs.tracing.htrace; - -import java.nio.charset.StandardCharsets; -import java.util.concurrent.Callable; - -import org.apache.cxf.tracing.Traceable; -import org.apache.cxf.tracing.TracerContext; -import org.apache.htrace.Sampler; -import org.apache.htrace.Trace; -import org.apache.htrace.TraceScope; -import org.apache.htrace.wrappers.TraceCallable; - -public class HTraceTracerContext implements TracerContext { - private final Sampler< ? > sampler; - - public HTraceTracerContext(final Sampler< ? > sampler) { - this.sampler = sampler; - } - - @Override - @SuppressWarnings("unchecked") - public TraceScope startSpan(final String description) { - return Trace.startSpan(description, sampler); - } - - @Override - public Callable wrap(final String desription, final Traceable traceable) { - final Callable callable = new Callable() { - @Override - public T call() throws Exception { - return traceable.call(new HTraceTracerContext(sampler)); - } - }; - - // TODO: Replace with HTrace's wrap() method once the version with - // callable and description becomes available. - if (Trace.isTracing()) { - return new TraceCallable(Trace.currentSpan(), callable, desription); - } else { - return callable; - } - } - - @Override - public void annotate(byte[] key, byte[] value) { - Trace.addKVAnnotation(key, value); - } - - @Override - public void annotate(String key, String value) { - annotate(key.getBytes(StandardCharsets.UTF_8), - value.getBytes(StandardCharsets.UTF_8)); - } - - @Override - public void timeline(String message) { - Trace.addTimelineAnnotation(message); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/c2b70fd4/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/HTraceTracerContext.java ---------------------------------------------------------------------- diff --git a/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/HTraceTracerContext.java b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/HTraceTracerContext.java new file mode 100644 index 0000000..2e92435 --- /dev/null +++ b/integration/tracing/tracing-htrace/src/main/java/org/apache/cxf/tracing/htrace/HTraceTracerContext.java @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.tracing.htrace; + +import java.nio.charset.StandardCharsets; +import java.util.concurrent.Callable; + +import org.apache.cxf.tracing.Traceable; +import org.apache.cxf.tracing.TracerContext; +import org.apache.htrace.Sampler; +import org.apache.htrace.Trace; +import org.apache.htrace.TraceScope; +import org.apache.htrace.wrappers.TraceCallable; + +public class HTraceTracerContext implements TracerContext { + private final Sampler< ? > sampler; + + public HTraceTracerContext(final Sampler< ? > sampler) { + this.sampler = sampler; + } + + @Override + @SuppressWarnings("unchecked") + public TraceScope startSpan(final String description) { + return Trace.startSpan(description, sampler); + } + + @Override + public Callable wrap(final String desription, final Traceable traceable) { + final Callable callable = new Callable() { + @Override + public T call() throws Exception { + return traceable.call(new HTraceTracerContext(sampler)); + } + }; + + // TODO: Replace with HTrace's wrap() method once the version with + // callable and description becomes available. + if (Trace.isTracing()) { + return new TraceCallable(Trace.currentSpan(), callable, desription); + } else { + return callable; + } + } + + @Override + public void annotate(byte[] key, byte[] value) { + Trace.addKVAnnotation(key, value); + } + + @Override + public void annotate(String key, String value) { + annotate(key.getBytes(StandardCharsets.UTF_8), + value.getBytes(StandardCharsets.UTF_8)); + } + + @Override + public void timeline(String message) { + Trace.addTimelineAnnotation(message); + } +}