You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/02/25 07:28:03 UTC

[incubator-skywalking] branch scope-refactor updated: ScopeDeclaration can be used once for each class only, now.

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch scope-refactor
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/scope-refactor by this push:
     new ce335dc  ScopeDeclaration can be used once for each class only, now.
ce335dc is described below

commit ce335dc4a3aca66bd0a65b89913c750affe0cbfc
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Feb 25 15:27:53 2019 +0800

    ScopeDeclaration can be used once for each class only, now.
---
 .../oap/server/core/source/DefaultScopeDefine.java | 13 +++-------
 .../oap/server/core/source/ScopeDeclaration.java   |  1 -
 .../oap/server/core/source/ScopeDeclarations.java  | 30 ----------------------
 3 files changed, 4 insertions(+), 40 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
index cf83b47..4bf9b6d 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java
@@ -53,18 +53,13 @@ public class DefaultScopeDefine {
 
     public static class Listener implements AnnotationListener {
         @Override public Class<? extends Annotation> annotation() {
-            return ScopeDeclarations.class;
+            return ScopeDeclaration.class;
         }
 
         @Override public void notify(Class originalClass) {
-            ScopeDeclarations declarations = (ScopeDeclarations)originalClass.getAnnotation(ScopeDeclarations.class);
-            if (declarations != null) {
-                ScopeDeclaration[] scopeDeclarations = declarations.value();
-                if (scopeDeclarations != null) {
-                    for (ScopeDeclaration declaration : scopeDeclarations) {
-                        addNewScope(declaration, originalClass);
-                    }
-                }
+            ScopeDeclaration declaration = (ScopeDeclaration)originalClass.getAnnotation(ScopeDeclaration.class);
+            if (declaration != null) {
+                addNewScope(declaration, originalClass);
             }
         }
     }
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
index 40be762..0f5f062 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclaration.java
@@ -27,7 +27,6 @@ import java.lang.annotation.*;
  */
 @Target({ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-@Repeatable(ScopeDeclarations.class)
 public @interface ScopeDeclaration {
     int id();
     String name();
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclarations.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclarations.java
deleted file mode 100644
index 6f16f5a..0000000
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/ScopeDeclarations.java
+++ /dev/null
@@ -1,30 +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.skywalking.oap.server.core.source;
-
-import java.lang.annotation.*;
-
-/**
- * @author wusheng
- */
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ScopeDeclarations {
-    ScopeDeclaration[] value();
-}