Skip to content

Commit

Permalink
[pinpoint-apm#6061] Refactor commons-module
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Oct 18, 2019
1 parent eb675fc commit 2a8e880
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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
* 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,
Expand All @@ -20,7 +20,7 @@
import com.navercorp.pinpoint.common.trace.AnnotationKeyMatcher;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext;
import com.navercorp.pinpoint.common.util.StaticFieldLookUp;
import com.navercorp.pinpoint.common.profiler.trace.StaticFieldLookUp;
import org.junit.rules.ErrorCollector;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/* copy from jsr166y
* http://anonsvn.jboss.org/repos/jbosscache/experimental/jsr166/src/jsr166y/ConcurrentReferenceHashMap.java
* package jsr166y;
*/
package com.navercorp.pinpoint.common.util.jsr166;
*/
package com.navercorp.pinpoint.common.profiler.concurrent.jsr166;

import java.io.IOException;
import java.io.Serializable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

/* copy from jsr166y
* http://anonsvn.jboss.org/repos/jbosscache/experimental/jsr166/src/jsr166y/ConcurrentReferenceHashMap.java
* http://anonsvn.jboss.org/repos/jbosscache/experimental/jsr166/src/jsr166y/ConcurrentWeakHashMap.java
* package jsr166y;
*/
package com.navercorp.pinpoint.common.util.jsr166;
package com.navercorp.pinpoint.common.profiler.concurrent.jsr166;

import java.io.IOException;
import java.io.Serializable;
Expand Down Expand Up @@ -1452,4 +1452,4 @@ private void readObject(java.io.ObjectInputStream s)
put(key, value);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2014 NAVER Corp.
* Copyright 2019 NAVER Corp.
*
* Licensed 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
* 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,
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.common.util;
package com.navercorp.pinpoint.common.profiler.trace;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.navercorp.pinpoint.common.trace.ServiceTypeInfo;
import com.navercorp.pinpoint.common.trace.TraceMetadataProvider;
import com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext;
import com.navercorp.pinpoint.common.util.StaticFieldLookUp;
import com.navercorp.pinpoint.common.util.logger.CommonLogger;
import com.navercorp.pinpoint.common.util.logger.CommonLoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Arrays;
import java.util.List;

import com.navercorp.pinpoint.common.profiler.trace.TraceMetadataLoader;
import com.navercorp.pinpoint.common.trace.AnnotationKey;
import com.navercorp.pinpoint.common.trace.AnnotationKeyFactory;
import com.navercorp.pinpoint.common.trace.AnnotationKeyLocator;
Expand All @@ -31,7 +30,6 @@
import com.navercorp.pinpoint.common.trace.TraceMetadataProvider;
import com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext;
import com.navercorp.pinpoint.common.util.logger.CommonLoggerFactory;
import com.navercorp.pinpoint.common.util.StaticFieldLookUp;
import com.navercorp.pinpoint.common.util.logger.StdoutCommonLoggerFactory;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.common.util;
package com.navercorp.pinpoint.common.profiler.trace;

import java.util.List;

import com.navercorp.pinpoint.common.trace.ServiceTypeFactory;
import org.junit.Assert;
import org.junit.Test;

import com.navercorp.pinpoint.common.trace.AnnotationKeyMatchers;
import com.navercorp.pinpoint.common.trace.ServiceType;

public class StaticFieldLookUpTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.navercorp.pinpoint.common.util;
package com.navercorp.pinpoint.common.profiler.trace;

/**
* @author Woonduk Kang(emeroad)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.navercorp.pinpoint.common.trace.ServiceTypeProperty;
import com.navercorp.pinpoint.common.trace.TraceMetadataProvider;
import com.navercorp.pinpoint.common.trace.TraceMetadataSetupContext;
import com.navercorp.pinpoint.common.util.StaticFieldLookUp;
import com.navercorp.pinpoint.common.util.logger.CommonLoggerFactory;
import com.navercorp.pinpoint.common.util.logger.StdoutCommonLoggerFactory;
import org.junit.Assert;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Copyright 2016 NAVER Corp.
* Copyright 2019 NAVER Corp.
*
* Licensed 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
* 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 com.navercorp.pinpoint.common.util;
Expand Down Expand Up @@ -42,13 +41,6 @@ public static <T> boolean isEmpty(final Collection<T> collection) {
return collection == null || collection.isEmpty();
}

/**
* @deprecated Since 1.7.0. Use {@link CollectionUtils#hasLength(Collection)}
*/
public static <T> boolean isNotEmpty(final Collection<T> collection) {
return hasLength(collection);
}

public static <T> boolean hasLength(final Collection<T> collection) {
return collection != null && !collection.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2014 NAVER Corp.
* Copyright 2019 NAVER Corp.
*
* Licensed 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
* 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,
Expand Down Expand Up @@ -72,44 +72,11 @@ public static ThreadInfo[] dumpAllThread() {
// }
}

/**
* @deprecated Since 1.7.0. Use {@link #getThreadInfo(long)}
*/
@Deprecated
public static ThreadInfo findThread(Thread thread) {
Assert.requireNonNull(thread, "thread must not be null");
return getThreadInfo(thread.getId());
}

/**
* @deprecated Since 1.7.0. Use {@link #getThreadInfo(long, int)}
*/
@Deprecated
public static ThreadInfo findThread(Thread thread, int stackTraceMaxDepth) {
Assert.requireNonNull(thread, "thread must not be null");
return getThreadInfo(thread.getId(), stackTraceMaxDepth);
}

/**
* @deprecated Since 1.7.0. Use {@link #getThreadInfo(long)}
*/
@Deprecated
public static ThreadInfo findThread(long id) {
return getThreadInfo(id, DEFAULT_STACK_TRACE_MAX_DEPTH);
}

public static ThreadInfo getThreadInfo(long id) {
return getThreadInfo(id, DEFAULT_STACK_TRACE_MAX_DEPTH);
}

/**
* @deprecated Since 1.7.0. Use {@link #getThreadInfo(long, int)}
*/
@Deprecated
public static ThreadInfo findThread(long id, int stackTraceMaxDepth) {
return getThreadInfo(id, stackTraceMaxDepth);
}

public static ThreadInfo getThreadInfo(long id, int stackTraceMaxDepth) {
if (stackTraceMaxDepth <= 0) {
return THREAD_MX_BEAN.getThreadInfo(id);
Expand All @@ -127,14 +94,14 @@ public static ThreadInfo[] findThread(long[] id, int stackTraceMaxDepth) {
}

public static List<ThreadInfo> findThread(String threadName) {
Assert.requireNonNull(threadName, "threadName must not be null");
Assert.requireNonNull(threadName, "threadName");

ThreadInfo[] threadInfos = dumpAllThread();
if (threadInfos == null) {
return Collections.emptyList();
}

ArrayList<ThreadInfo> threadInfoList = new ArrayList<ThreadInfo>(1);
List<ThreadInfo> threadInfoList = new ArrayList<ThreadInfo>(1);
for (ThreadInfo threadInfo : threadInfos) {
if (threadName.equals(threadInfo.getThreadName())) {
threadInfoList.add(threadInfo);
Expand Down
2 changes: 1 addition & 1 deletion filefilter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* default
- \com\navercorp\pinpoint\thrift\dto
- \com\navercorp\pinpoint\common\util\apache
- \com\navercorp\pinpoint\common\util\jsr166
- \com\navercorp\pinpoint\common\profiler\util\jsr166
- \com\navercorp\pinpoint\profiler\util\jdk
- \com\navercorp\pinpoint\bootstrap\util\spring
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@
<excludes>
<exclude>com/navercorp/pinpoint/thrift/dto/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/apache/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/profiler/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/profiler/util/jdk/**/*.java</exclude>
</excludes>
</configuration>
Expand Down Expand Up @@ -955,7 +955,7 @@
<excludes>
<exclude>com/navercorp/pinpoint/thrift/dto/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/apache/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/profiler/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/profiler/util/jdk/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/grpc/trace/**/*.java</exclude>

Expand Down Expand Up @@ -1049,7 +1049,7 @@
<excludes>
<exclude>com/navercorp/pinpoint/thrift/dto/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/apache/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/profiler/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/profiler/util/jdk/**/*.java</exclude>
</excludes>
</configuration>
Expand All @@ -1074,7 +1074,7 @@
<excludes>
<exclude>com/navercorp/pinpoint/thrift/dto/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/apache/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/common/profiler/util/jsr166/**/*.java</exclude>
<exclude>com/navercorp/pinpoint/profiler/util/jdk/**/*.java</exclude>
</excludes>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 NAVER Corp.
* Copyright 2019 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,8 @@

package com.navercorp.pinpoint.profiler.instrument.classloading;

import com.navercorp.pinpoint.common.profiler.concurrent.jsr166.ConcurrentWeakHashMap;
import com.navercorp.pinpoint.common.util.Assert;
import com.navercorp.pinpoint.common.util.jsr166.ConcurrentWeakHashMap;
import com.navercorp.pinpoint.exception.PinpointException;
import com.navercorp.pinpoint.profiler.instrument.classreading.SimpleClassMetadata;
import com.navercorp.pinpoint.profiler.instrument.classreading.SimpleClassMetadataReader;
Expand Down

0 comments on commit 2a8e880

Please sign in to comment.