mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-25 12:46:21 +10:00
Merge branch '#119_ui_bug_fix' of emeroad/pinpoint-opensource
from pull-request 269 * refs/heads/#119_ui_bug_fix: #119 code clean-up - findbug, pmd, klocwork warning #119 code clean-up - findbug, pmd, klocwork warning
This commit is contained in:
@@ -17,6 +17,7 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class ProfilerConfig {
|
||||
private static final Logger logger = Logger.getLogger(ProfilerConfig.class.getName());
|
||||
private static final String DEFAULT_IP = "127.0.0.1";
|
||||
|
||||
private final Properties properties;
|
||||
private final PropertyPlaceholderHelper propertyPlaceholderHelper = new PropertyPlaceholderHelper("${", "}");
|
||||
@@ -63,13 +64,13 @@ public class ProfilerConfig {
|
||||
|
||||
private boolean profileEnable = false;
|
||||
|
||||
private String collectorSpanServerIp = "127.0.0.1";
|
||||
private String collectorSpanServerIp = DEFAULT_IP;
|
||||
private int collectorSpanServerPort = 9996;
|
||||
|
||||
private String collectorStatServerIp = "127.0.0.1";
|
||||
private String collectorStatServerIp = DEFAULT_IP;
|
||||
private int collectorStatServerPort = 9995;
|
||||
|
||||
private String collectorTcpServerIp = "127.0.0.1";
|
||||
private String collectorTcpServerIp = DEFAULT_IP;
|
||||
private int collectorTcpServerPort = 9994;
|
||||
|
||||
private int spanDataSenderWriteQueueSize = 1024 * 5;
|
||||
@@ -564,13 +565,13 @@ public class ProfilerConfig {
|
||||
this.profileEnable = readBoolean("profiler.enable", true);
|
||||
|
||||
|
||||
this.collectorSpanServerIp = readString("profiler.collector.span.ip", "127.0.0.1", placeHolderResolver);
|
||||
this.collectorSpanServerIp = readString("profiler.collector.span.ip", DEFAULT_IP, placeHolderResolver);
|
||||
this.collectorSpanServerPort = readInt("profiler.collector.span.port", 9996);
|
||||
|
||||
this.collectorStatServerIp = readString("profiler.collector.stat.ip", "127.0.0.1", placeHolderResolver);
|
||||
this.collectorStatServerIp = readString("profiler.collector.stat.ip", DEFAULT_IP, placeHolderResolver);
|
||||
this.collectorStatServerPort = readInt("profiler.collector.stat.port", 9995);
|
||||
|
||||
this.collectorTcpServerIp = readString("profiler.collector.tcp.ip", "127.0.0.1", placeHolderResolver);
|
||||
this.collectorTcpServerIp = readString("profiler.collector.tcp.ip", DEFAULT_IP, placeHolderResolver);
|
||||
this.collectorTcpServerPort = readInt("profiler.collector.tcp.port", 9994);
|
||||
|
||||
this.spanDataSenderWriteQueueSize = readInt("profiler.spandatasender.write.queue.size", 1024 * 5);
|
||||
|
||||
+4
-1
@@ -5,7 +5,10 @@ import com.navercorp.pinpoint.bootstrap.context.DatabaseInfo;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class DatabaseInfoTraceValueUtils {
|
||||
public final class DatabaseInfoTraceValueUtils {
|
||||
|
||||
private DatabaseInfoTraceValueUtils() {
|
||||
}
|
||||
|
||||
public static DatabaseInfo __getTraceDatabaseInfo(Object target, DatabaseInfo defaultValue) {
|
||||
if (target == null) {
|
||||
|
||||
@@ -5,8 +5,10 @@ import java.util.Arrays;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class LoggingUtils {
|
||||
public final class LoggingUtils {
|
||||
|
||||
private LoggingUtils() {
|
||||
}
|
||||
|
||||
public static void logBefore(PLogger logger, Object target, String className, String methodName, String parameterDescription, Object[] args) {
|
||||
StringBuilder sb = new StringBuilder(512);
|
||||
|
||||
+19
-17
@@ -8,29 +8,31 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
public abstract class BytecodeUtils {
|
||||
private BytecodeUtils() { }
|
||||
public final class BytecodeUtils {
|
||||
|
||||
private static final Method DEFINE_CLASS;
|
||||
|
||||
static {
|
||||
Method method = null;
|
||||
|
||||
private static final Method DEFINE_CLASS = getDefineClassMethod();
|
||||
|
||||
private BytecodeUtils() {
|
||||
}
|
||||
|
||||
|
||||
private static Method getDefineClassMethod() {
|
||||
try {
|
||||
method = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
|
||||
final Method method = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class);
|
||||
method.setAccessible(true);
|
||||
return method;
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
// link error
|
||||
throw new RuntimeException("defineClass not found. Caused:" + e.getMessage(), e);
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
// link error
|
||||
throw new RuntimeException("defineClass error. Caused:" + e.getMessage(), e);
|
||||
}
|
||||
|
||||
DEFINE_CLASS = method;
|
||||
}
|
||||
|
||||
public static Class<?> defineClass(ClassLoader classLoader, String className, byte[] classFile) {
|
||||
try {
|
||||
return (Class<?>)DEFINE_CLASS.invoke(classLoader, className, classFile, 0, classFile.length);
|
||||
return (Class<?>) DEFINE_CLASS.invoke(classLoader, className, classFile, 0, classFile.length);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
@@ -48,13 +50,13 @@ public abstract class BytecodeUtils {
|
||||
if (is == null) {
|
||||
throw new RuntimeException("No such class file: " + className);
|
||||
}
|
||||
|
||||
|
||||
ReadableByteChannel channel = Channels.newChannel(is);
|
||||
ByteBuffer buffer;
|
||||
|
||||
|
||||
try {
|
||||
buffer = ByteBuffer.allocate(is.available());
|
||||
|
||||
|
||||
while (channel.read(buffer) >= 0) {
|
||||
if (buffer.remaining() == 0) {
|
||||
buffer.flip();
|
||||
@@ -68,7 +70,7 @@ public abstract class BytecodeUtils {
|
||||
} finally {
|
||||
close(is);
|
||||
}
|
||||
|
||||
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ public class ClassEditorBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
public class MetadataBuilder {
|
||||
public static class MetadataBuilder {
|
||||
private String metadataAccessorTypeName;
|
||||
private MetadataInitializationStrategy initializationStrategy;
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.navercorp.pinpoint.bootstrap.plugin;
|
||||
|
||||
public abstract class TypeUtils {
|
||||
public final class TypeUtils {
|
||||
|
||||
private TypeUtils() {
|
||||
}
|
||||
|
||||
public static Class<?> getWrapperOf(Class<?> primitive) {
|
||||
if (primitive == boolean.class) {
|
||||
return Boolean.class;
|
||||
|
||||
@@ -3,14 +3,13 @@ package com.navercorp.pinpoint.bootstrap.util;
|
||||
import com.navercorp.pinpoint.common.PinpointConstants;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class IdValidateUtils {
|
||||
public final class IdValidateUtils {
|
||||
|
||||
private static final int DEFAULT_MAX_LENGTH = PinpointConstants.AGENT_NAME_MAX_LEN;
|
||||
|
||||
|
||||
+6
-5
@@ -97,9 +97,12 @@ public class ZookeeperWebClusterManager implements Runnable {
|
||||
|
||||
logger.info("{} destorying started.", this.getClass().getSimpleName());
|
||||
|
||||
queue.offer(stopTask);
|
||||
final boolean stopOffer = queue.offer(stopTask);
|
||||
if (!stopOffer) {
|
||||
logger.warn("stopTask offer fail. Message Queue.");
|
||||
}
|
||||
|
||||
boolean interrupted = false;
|
||||
boolean interrupted = false;
|
||||
while (this.workerThread.isAlive()) {
|
||||
this.workerThread.interrupt();
|
||||
try {
|
||||
@@ -119,8 +122,7 @@ public class ZookeeperWebClusterManager implements Runnable {
|
||||
public void handleAndRegisterWatcher(String path) {
|
||||
if (workerState.isStarted()) {
|
||||
if (zNodePath.equals(path)) {
|
||||
boolean offerSuccess = queue.offer(getAndRegisterTask);
|
||||
|
||||
final boolean offerSuccess = queue.offer(getAndRegisterTask);
|
||||
if (!offerSuccess) {
|
||||
logger.info("Message Queue is Full.");
|
||||
}
|
||||
@@ -130,7 +132,6 @@ public class ZookeeperWebClusterManager implements Runnable {
|
||||
} else {
|
||||
WorkerState state = this.workerState.getCurrentState();
|
||||
logger.info("{} invalid state {}.", this.getClass().getSimpleName(), state.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public abstract class AbstractDispatchHandler implements DispatchHandler {
|
||||
throw new UnsupportedOperationException("Handler not found. Unknown type of data received. tBase=" + tBase);
|
||||
}
|
||||
|
||||
public TBase dispatchRequestMessage(org.apache.thrift.TBase<?,?> tBase, byte[] packet, int offset, int length) {
|
||||
public TBase dispatchRequestMessage(TBase<?,?> tBase, byte[] packet, int offset, int length) {
|
||||
// accepted time 마크
|
||||
acceptedTimeService.accept();
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ import java.net.DatagramPacket;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class PacketUtils {
|
||||
public final class PacketUtils {
|
||||
private PacketUtils() {
|
||||
}
|
||||
|
||||
public static String dumpDatagramPacket(DatagramPacket datagramPacket) {
|
||||
if (datagramPacket == null) {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.navercorp.pinpoint.common.bo;
|
||||
|
||||
import com.navercorp.pinpoint.common.PinpointConstants;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.util.RowKeyUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
import static com.navercorp.pinpoint.common.PinpointConstants.*;
|
||||
import static com.navercorp.pinpoint.common.util.BytesUtils.*;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
@@ -76,17 +74,17 @@ public class ApiMetaDataBo {
|
||||
}
|
||||
|
||||
public void readRowKey(byte[] bytes) {
|
||||
this.agentId = Bytes.toString(bytes, 0, AGENT_NAME_MAX_LEN).trim();
|
||||
this.agentId = Bytes.toString(bytes, 0, PinpointConstants.AGENT_NAME_MAX_LEN).trim();
|
||||
this.startTime = TimeUtils.recoveryTimeMillis(readTime(bytes));
|
||||
this.apiId = readKeyCode(bytes);
|
||||
}
|
||||
|
||||
private static long readTime(byte[] rowKey) {
|
||||
return BytesUtils.bytesToLong(rowKey, AGENT_NAME_MAX_LEN);
|
||||
return BytesUtils.bytesToLong(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN);
|
||||
}
|
||||
|
||||
private static int readKeyCode(byte[] rowKey) {
|
||||
return BytesUtils.bytesToInt(rowKey, AGENT_NAME_MAX_LEN + LONG_BYTE_LENGTH);
|
||||
return BytesUtils.bytesToInt(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN + BytesUtils.LONG_BYTE_LENGTH);
|
||||
}
|
||||
|
||||
public byte[] toRowKey() {
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package com.navercorp.pinpoint.common.bo;
|
||||
|
||||
import com.navercorp.pinpoint.common.PinpointConstants;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.util.RowKeyUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
import static com.navercorp.pinpoint.common.PinpointConstants.*;
|
||||
import static com.navercorp.pinpoint.common.util.BytesUtils.*;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
@@ -67,18 +66,18 @@ public class SqlMetaDataBo {
|
||||
}
|
||||
|
||||
public void readRowKey(byte[] rowKey) {
|
||||
this.agentId = Bytes.toString(rowKey, 0, AGENT_NAME_MAX_LEN).trim();
|
||||
this.agentId = Bytes.toString(rowKey, 0, PinpointConstants.AGENT_NAME_MAX_LEN).trim();
|
||||
this.startTime = TimeUtils.recoveryTimeMillis(readTime(rowKey));
|
||||
this.hashCode = readKeyCode(rowKey);
|
||||
}
|
||||
|
||||
|
||||
private static long readTime(byte[] rowKey) {
|
||||
return BytesUtils.bytesToLong(rowKey, AGENT_NAME_MAX_LEN);
|
||||
return BytesUtils.bytesToLong(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN);
|
||||
}
|
||||
|
||||
private static int readKeyCode(byte[] rowKey) {
|
||||
return BytesUtils.bytesToInt(rowKey, AGENT_NAME_MAX_LEN + LONG_BYTE_LENGTH);
|
||||
return BytesUtils.bytesToInt(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN + BytesUtils.LONG_BYTE_LENGTH);
|
||||
}
|
||||
|
||||
public byte[] toRowKey() {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.navercorp.pinpoint.common.bo;
|
||||
|
||||
import com.navercorp.pinpoint.common.PinpointConstants;
|
||||
import com.navercorp.pinpoint.common.util.BytesUtils;
|
||||
import com.navercorp.pinpoint.common.util.RowKeyUtils;
|
||||
import com.navercorp.pinpoint.common.util.TimeUtils;
|
||||
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
import static com.navercorp.pinpoint.common.PinpointConstants.*;
|
||||
import static com.navercorp.pinpoint.common.util.BytesUtils.*;
|
||||
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
@@ -67,18 +65,18 @@ public class StringMetaDataBo {
|
||||
}
|
||||
|
||||
public void readRowKey(byte[] rowKey) {
|
||||
this.agentId = Bytes.toString(rowKey, 0, AGENT_NAME_MAX_LEN).trim();
|
||||
this.agentId = Bytes.toString(rowKey, 0, PinpointConstants.AGENT_NAME_MAX_LEN).trim();
|
||||
this.startTime = TimeUtils.recoveryTimeMillis(readTime(rowKey));
|
||||
this.stringId = readKeyCode(rowKey);
|
||||
}
|
||||
|
||||
|
||||
private static long readTime(byte[] rowKey) {
|
||||
return BytesUtils.bytesToLong(rowKey, AGENT_NAME_MAX_LEN);
|
||||
return BytesUtils.bytesToLong(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN);
|
||||
}
|
||||
|
||||
private static int readKeyCode(byte[] rowKey) {
|
||||
return BytesUtils.bytesToInt(rowKey, AGENT_NAME_MAX_LEN + LONG_BYTE_LENGTH);
|
||||
return BytesUtils.bytesToInt(rowKey, PinpointConstants.AGENT_NAME_MAX_LEN + BytesUtils.LONG_BYTE_LENGTH);
|
||||
}
|
||||
|
||||
public byte[] toRowKey() {
|
||||
|
||||
@@ -10,7 +10,9 @@ import com.navercorp.pinpoint.common.bo.Span;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class AnnotationUtils {
|
||||
public final class AnnotationUtils {
|
||||
private AnnotationUtils() {
|
||||
}
|
||||
|
||||
public static String findApiAnnotation(List<AnnotationBo> list) {
|
||||
if (list == null) {
|
||||
|
||||
+2
@@ -19,6 +19,8 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||
* @author emeroad
|
||||
*/
|
||||
public class ApplicationMapStatisticsUtils {
|
||||
private ApplicationMapStatisticsUtils() {
|
||||
}
|
||||
|
||||
public static byte[] makeColumnName(short serviceType, String applicationName, String destHost, short slotNumber) {
|
||||
if (applicationName == null) {
|
||||
|
||||
@@ -21,6 +21,8 @@ public final class BytesUtils {
|
||||
private static final String UTF8 = "UTF-8";
|
||||
private static final Logger LOGGER = Logger.getLogger(BytesUtils.class.getName());
|
||||
|
||||
private BytesUtils() {
|
||||
}
|
||||
|
||||
public static byte[] stringLongLongToBytes(final String string, final int maxStringSize, final long value1, final long value2) {
|
||||
if (string == null) {
|
||||
|
||||
@@ -12,6 +12,9 @@ public final class ClassLoaderUtils {
|
||||
}
|
||||
};
|
||||
|
||||
private ClassLoaderUtils() {
|
||||
}
|
||||
|
||||
public static ClassLoader getDefaultClassLoader() {
|
||||
return getDefaultClassLoader(DEFAULT_CLASS_LOADER_CALLABLE);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ package com.navercorp.pinpoint.common.util;
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class ClassUtils {
|
||||
public final class ClassUtils {
|
||||
|
||||
private static final Object CLASS_NOT_LOADED = null;
|
||||
private static final char PACKAGE_SEPARATOR = '.';
|
||||
|
||||
|
||||
private ClassUtils() {
|
||||
}
|
||||
|
||||
public static boolean isLoaded(String name) {
|
||||
return isLoaded(name, ClassLoaderUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@ package com.navercorp.pinpoint.common.util;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class HttpUtils {
|
||||
public final class HttpUtils {
|
||||
|
||||
private static final String UTF8 = "UTF-8";
|
||||
|
||||
private static final String CHARSET = "charset=";
|
||||
|
||||
private HttpUtils() {
|
||||
}
|
||||
|
||||
public static String parseContentTypeCharset(String contentType) {
|
||||
return parseContentTypeCharset(contentType, UTF8);
|
||||
}
|
||||
|
||||
@@ -7,14 +7,13 @@ import java.util.Map;
|
||||
/**
|
||||
* @author hyungil.jeong
|
||||
*/
|
||||
public class JvmUtils {
|
||||
public final class JvmUtils {
|
||||
private static final RuntimeMXBean RUNTIME_MX_BEAN = ManagementFactory.getRuntimeMXBean();
|
||||
private static final Map<String, String> SYSTEM_PROPERTIES = RUNTIME_MX_BEAN.getSystemProperties();
|
||||
|
||||
private static final JvmVersion JVM_VERSION = _getVersion();
|
||||
|
||||
private JvmUtils() {
|
||||
throw new IllegalAccessError();
|
||||
}
|
||||
|
||||
public static JvmVersion getVersion() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Properties;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class PropertyUtils {
|
||||
public final class PropertyUtils {
|
||||
public static final String DEFAULT_ENCODING = "UTF-8";
|
||||
|
||||
private static final ClassLoaderUtils.ClassLoaderCallable CLASS_LOADER_CALLABLE = new ClassLoaderUtils.ClassLoaderCallable() {
|
||||
@@ -20,6 +20,9 @@ public class PropertyUtils {
|
||||
InputStream openInputStream() throws IOException;
|
||||
}
|
||||
|
||||
private PropertyUtils() {
|
||||
}
|
||||
|
||||
public static Properties loadProperty(final String filePath) throws IOException {
|
||||
if (filePath == null) {
|
||||
throw new NullPointerException("filePath must not be null");
|
||||
@@ -31,7 +34,7 @@ public class PropertyUtils {
|
||||
}
|
||||
};
|
||||
return loadProperty(new Properties(), inputStreamFactory, DEFAULT_ENCODING);
|
||||
}
|
||||
}
|
||||
|
||||
public static Properties loadPropertyFromClassPath(final String classPath) throws IOException {
|
||||
if (classPath == null) {
|
||||
@@ -46,18 +49,18 @@ public class PropertyUtils {
|
||||
return loadProperty(new Properties(), inputStreamFactory, DEFAULT_ENCODING);
|
||||
}
|
||||
|
||||
public static Properties loadPropertyFromClassLoader(final ClassLoader classLoader, final String classPath) throws IOException {
|
||||
if (classLoader == null) {
|
||||
throw new NullPointerException("classLoader must not be null");
|
||||
}
|
||||
final InputStreamFactory inputStreamFactory = new InputStreamFactory() {
|
||||
@Override
|
||||
public InputStream openInputStream() throws IOException {
|
||||
return classLoader.getResourceAsStream(classPath);
|
||||
}
|
||||
};
|
||||
return loadProperty(new Properties(), inputStreamFactory, DEFAULT_ENCODING);
|
||||
}
|
||||
public static Properties loadPropertyFromClassLoader(final ClassLoader classLoader, final String classPath) throws IOException {
|
||||
if (classLoader == null) {
|
||||
throw new NullPointerException("classLoader must not be null");
|
||||
}
|
||||
final InputStreamFactory inputStreamFactory = new InputStreamFactory() {
|
||||
@Override
|
||||
public InputStream openInputStream() throws IOException {
|
||||
return classLoader.getResourceAsStream(classPath);
|
||||
}
|
||||
};
|
||||
return loadProperty(new Properties(), inputStreamFactory, DEFAULT_ENCODING);
|
||||
}
|
||||
|
||||
|
||||
public static Properties loadProperty(Properties properties, InputStreamFactory inputStreamFactory, String encoding) throws IOException {
|
||||
|
||||
@@ -8,9 +8,11 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class RowKeyUtils {
|
||||
public final class RowKeyUtils {
|
||||
private RowKeyUtils() {
|
||||
}
|
||||
|
||||
public static byte[] concatFixedByteAndLong(byte[] fixedBytes, int maxFixedLength, long l) {
|
||||
public static byte[] concatFixedByteAndLong(byte[] fixedBytes, int maxFixedLength, long l) {
|
||||
if (fixedBytes == null) {
|
||||
throw new NullPointerException("fixedBytes must not null");
|
||||
}
|
||||
|
||||
@@ -6,9 +6,15 @@ import com.navercorp.pinpoint.thrift.dto.TSpanEvent;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class SpanEventUtils {
|
||||
public final class SpanEventUtils {
|
||||
|
||||
private SpanEventUtils() {
|
||||
}
|
||||
|
||||
public static boolean hasException(TSpanEvent spanEvent) {
|
||||
if (spanEvent == null) {
|
||||
throw new NullPointerException("spanEvent must not be null");
|
||||
}
|
||||
if (spanEvent.isSetExceptionInfo()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ import com.navercorp.pinpoint.thrift.dto.TSpanChunk;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class SpanUtils {
|
||||
public final class SpanUtils {
|
||||
private SpanUtils() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static byte[] getAgentIdTraceIndexRowKey(String agentId, long timestamp) {
|
||||
if (agentId == null) {
|
||||
|
||||
@@ -4,6 +4,8 @@ package com.navercorp.pinpoint.common.util;
|
||||
* @author emeroad
|
||||
*/
|
||||
public final class TimeUtils {
|
||||
private TimeUtils() {
|
||||
}
|
||||
|
||||
public static long reverseTimeMillis(long currentTimeMillis) {
|
||||
return Long.MAX_VALUE - currentTimeMillis;
|
||||
|
||||
@@ -12,6 +12,9 @@ public final class TransactionIdUtils {
|
||||
public static final String TRANSACTION_ID_DELIMITER = "^";
|
||||
public static final byte VERSION = 0;
|
||||
|
||||
private TransactionIdUtils() {
|
||||
}
|
||||
|
||||
public static String formatString(String agentId, long agentStartTime, long transactionSequence) {
|
||||
if (agentId == null) {
|
||||
throw new NullPointerException("agentId must not be null");
|
||||
|
||||
-1
@@ -175,7 +175,6 @@ public class Slf4jPLoggerAdapter implements PLogger {
|
||||
}
|
||||
sb.append(')');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private static String normalizedParameter(Object arg) {
|
||||
|
||||
+4
-1
@@ -5,7 +5,10 @@ import com.navercorp.pinpoint.bootstrap.instrument.MethodInfo;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class ParameterUtils {
|
||||
public final class ParameterUtils {
|
||||
|
||||
private ParameterUtils() {
|
||||
}
|
||||
|
||||
public static int findFirstString(MethodInfo method, int maxIndex) {
|
||||
if (method == null) {
|
||||
|
||||
-2
@@ -184,7 +184,6 @@ public class OracleNetConnectionDescriptorTokenizer {
|
||||
if (!(token == TOKEN_EQUAL_OBJECT)) {
|
||||
throw new OracleConnectionStringException("Syntax error. Expected token='=' :" + token.getToken());
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
public void checkEndToken() {
|
||||
@@ -196,7 +195,6 @@ public class OracleNetConnectionDescriptorTokenizer {
|
||||
if (!(token == TOKEN_KEY_END_OBJECT)) {
|
||||
throw new OracleConnectionStringException("Syntax error. Expected token=')' :" + token.getToken());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public Token getLiteralToken() {
|
||||
|
||||
@@ -51,7 +51,6 @@ public final class AnnotationValueMapper {
|
||||
}
|
||||
String str = StringUtils.drop(value.toString());
|
||||
annotation.setValue(TAnnotationValue.stringValue(str));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,15 +5,19 @@ import java.util.Random;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ErrorInjectUtils {
|
||||
public final class ErrorInjectUtils {
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
private ErrorInjectUtils() {
|
||||
}
|
||||
|
||||
public static void randomSleep(int mod) {
|
||||
int i = Math.abs(random.nextInt() % mod);
|
||||
try {
|
||||
Thread.sleep(i);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -13,12 +13,15 @@ import java.util.regex.Pattern;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class PreparedStatementUtils {
|
||||
public final class PreparedStatementUtils {
|
||||
|
||||
private static final Pattern BIND_SETTER = Pattern.compile("set[A-Z]([a-zA-Z]+)");
|
||||
|
||||
private static final List<Method> bindMethod;
|
||||
|
||||
private PreparedStatementUtils() {
|
||||
}
|
||||
|
||||
static {
|
||||
bindMethod = findBindVariableSetMethod0();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class RuntimeMXBeanUtils {
|
||||
}
|
||||
|
||||
public static List<String> getVmArgs() {
|
||||
List<String> vmArgs = RUNTIME_MBEAN.getInputArguments();
|
||||
final List<String> vmArgs = RUNTIME_MBEAN.getInputArguments();
|
||||
if (vmArgs == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -76,6 +76,10 @@ public final class RuntimeMXBeanUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getName() {
|
||||
return RUNTIME_MBEAN.getName();
|
||||
}
|
||||
|
||||
private static Logger getLogger() {
|
||||
return Logger.getLogger(RuntimeMXBeanUtils.class.getName());
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ public final class SystemUtils {
|
||||
}
|
||||
|
||||
public static long getCurrentThreadCpuTime() {
|
||||
return THREAD_MX_BEAN.getCurrentThreadCpuTime();
|
||||
}
|
||||
return THREAD_MX_BEAN.getCurrentThreadCpuTime();
|
||||
}
|
||||
|
||||
public static long getCurrentThreadUserTime() {
|
||||
return THREAD_MX_BEAN.getCurrentThreadUserTime();
|
||||
return THREAD_MX_BEAN.getCurrentThreadUserTime();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import javassist.Loader;
|
||||
*/
|
||||
public final class LoaderUtils {
|
||||
|
||||
private LoaderUtils() {
|
||||
}
|
||||
|
||||
public static Loader createLoader(ClassPool classPool) {
|
||||
if (classPool == null) {
|
||||
throw new NullPointerException("classPool must not be null");
|
||||
|
||||
@@ -668,7 +668,7 @@ public class PinpointSocketHandler extends SimpleChannelHandler implements Socke
|
||||
}
|
||||
}
|
||||
|
||||
class SocketHandlerContext {
|
||||
static class SocketHandlerContext {
|
||||
private final Channel channel;
|
||||
private final StreamChannelManager streamChannelManager;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ControlMessageEncoder {
|
||||
}
|
||||
|
||||
private void encode(Object value, ChannelBuffer cb) throws ProtocolException {
|
||||
try {
|
||||
// try {
|
||||
if (value == null) {
|
||||
encodeNull(cb);
|
||||
} else if (value instanceof String) {
|
||||
@@ -75,9 +75,9 @@ public class ControlMessageEncoder {
|
||||
} else {
|
||||
throw new ProtocolException("Unsupported type : " + value.getClass().getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ProtocolException(e);
|
||||
}
|
||||
// } catch (Exception e) {
|
||||
// throw new ProtocolException(e);
|
||||
// }
|
||||
}
|
||||
|
||||
private void encodeNull(ChannelBuffer out) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.navercorp.pinpoint.rpc.control.ProtocolException;
|
||||
/**
|
||||
* @author koo.taejin
|
||||
*/
|
||||
public class ControlMessageEncodingUtils {
|
||||
public final class ControlMessageEncodingUtils {
|
||||
|
||||
private static final ControlMessageEncoder encoder = new ControlMessageEncoder();
|
||||
private static final ControlMessageDecoder decoder = new ControlMessageDecoder();
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Map;
|
||||
/**
|
||||
* @author koo.taejin
|
||||
*/
|
||||
public class MapUtils {
|
||||
public final class MapUtils {
|
||||
|
||||
private MapUtils() {
|
||||
}
|
||||
|
||||
@@ -5,10 +5,13 @@ import java.util.Random;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
public class TestByteUtils {
|
||||
public final class TestByteUtils {
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
private TestByteUtils() {
|
||||
}
|
||||
|
||||
public static byte[] createRandomByte(int size) {
|
||||
byte[] bytes = new byte[size];
|
||||
RANDOM.nextBytes(bytes);
|
||||
|
||||
@@ -3,7 +3,11 @@ package com.navercorp.pinpoint.thrift.io;
|
||||
/**
|
||||
* @author emeroad
|
||||
*/
|
||||
class BytesUtils {
|
||||
final class BytesUtils {
|
||||
|
||||
private BytesUtils() {
|
||||
}
|
||||
|
||||
public static byte writeShort1(final short value) {
|
||||
return (byte) (value >> 8);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ final class HeaderUtils {
|
||||
public static final int PASS_L4 = 85; // Udp
|
||||
public static final int FAIL = 0;
|
||||
|
||||
private HeaderUtils() {
|
||||
}
|
||||
|
||||
public static int validateSignature(byte signature) {
|
||||
if (Header.SIGNATURE == signature) {
|
||||
return OK;
|
||||
|
||||
@@ -9,7 +9,10 @@ import java.util.StringTokenizer;
|
||||
* @author emeroad
|
||||
* @since 1.7.4
|
||||
*/
|
||||
public class SqlUtils {
|
||||
public final class SqlUtils {
|
||||
private SqlUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* query의 빈줄<code>" \t\n\r\f"</code>을 모두 제거하여 한줄로 만든다.
|
||||
* @param original 원본 query
|
||||
|
||||
@@ -6,6 +6,9 @@ package com.navercorp.pinpoint.web.util;
|
||||
public final class LimitUtils {
|
||||
public static final int MAX = 10000;
|
||||
|
||||
private LimitUtils() {
|
||||
}
|
||||
|
||||
public static int checkRange(final int limit) {
|
||||
if (limit < 0) {
|
||||
throw new IllegalArgumentException("negative limit:" + limit);
|
||||
|
||||
@@ -4,6 +4,9 @@ package com.navercorp.pinpoint.web.util;
|
||||
*
|
||||
*/
|
||||
public class TimeUtils {
|
||||
private TimeUtils() {
|
||||
}
|
||||
|
||||
public static long getDelayLastTime() {
|
||||
return System.currentTimeMillis() - 3000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user