Skip to content

Commit

Permalink
Merge branch 'master' of emeroad/pinpoint
Browse files Browse the repository at this point in the history
from pull-request 20

* refs/heads/master:
  code cleanup : remove deprecated testcase, remove Sys.out
  • Loading branch information
emeroad committed Sep 24, 2014
2 parents e7d4575 + 3b17dc6 commit 26cbadd
Show file tree
Hide file tree
Showing 54 changed files with 767 additions and 955 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public boolean isIoBufferingEnable() {
return ioBufferingEnable;
}

public int getIoBufferingBufferBufferSize() {
public int getIoBufferingBufferSize() {
return ioBufferingBufferSize;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public int addInterceptor0(StaticAroundInterceptor interceptor) {
if (interceptor == null) {
return -1;
}
int newId = nextId();
final int newId = nextId();
if (newId >= max) {
throw new IndexOutOfBoundsException("size=" + index.length + " id=" + id);
}
Expand All @@ -55,7 +55,7 @@ int addSimpleInterceptor0(SimpleAroundInterceptor interceptor) {
if (interceptor == null) {
return -1;
}
int newId = nextId();
final int newId = nextId();
if (newId >= max) {
throw new IndexOutOfBoundsException("size=" + index.length + " id=" + id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void ioBuffering_test() throws IOException {
profilerConfig.readConfigFile(path);

Assert.assertEquals(profilerConfig.isIoBufferingEnable(), false);
Assert.assertEquals(profilerConfig.getIoBufferingBufferBufferSize(), 30);
Assert.assertEquals(profilerConfig.getIoBufferingBufferSize(), 30);
}

@Test
Expand All @@ -79,7 +79,7 @@ public void ioBuffering_default() throws IOException {
profilerConfig.readConfigFile(path);

Assert.assertEquals(profilerConfig.isIoBufferingEnable(), true);
Assert.assertEquals(profilerConfig.getIoBufferingBufferBufferSize(), 10);
Assert.assertEquals(profilerConfig.getIoBufferingBufferSize(), 10);
}

@Test
Expand Down
5 changes: 5 additions & 0 deletions collector/src/main/resources-local/hbase.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# local
#hbase.client.host=localhost
# dev
#hbase.client.host=dev.zk.pinpoint.navercorp.com
# local-dev
hbase.client.host=10.101.17.108
# ??
#hbase.client.host=10.25.149.61
hbase.client.port=2181
hbase.htable.threads.max=4
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
Expand All @@ -33,6 +35,8 @@
@ContextConfiguration("classpath:applicationContext-collector.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class TCPReceiverBOTest {
private final Logger logger = LoggerFactory.getLogger(this.getClass());


@Autowired
private TCPReceiver tcpReceiver;
Expand Down Expand Up @@ -99,7 +103,7 @@ private ResponsePacket readAndDecode(InputStream is, long waitTimeMillis) throws
is.read(payload);

for (byte b : payload) {
System.out.print("!!" + b);
logger.warn("!!!{}", b);
}

ChannelBuffer cb = ChannelBuffers.wrappedBuffer(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public void server() throws IOException, InterruptedException {
public void run() {
udpServer.bind(new InetSocketAddress("127.0.0.1", PORT));
try {
System.out.println("server-await");
logger.debug("server-await");
latch.await();
} catch (InterruptedException e) {
}
}
});
thread.start();
Thread.sleep(1000);
System.out.println("start--------");
logger.debug("start--------");
// ExecutorService executorService = Executors.newFixedThreadPool(10);
// for (int i =0; i< 10; i++) {
// executorService.execute(new Runnable() {
Expand Down Expand Up @@ -90,7 +90,7 @@ public ChannelPipeline getPipeline() throws Exception {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
String name = Thread.currentThread().getName();
System.out.println("sleep-------------------" + name);
logger.debug("sleep-------------------{}", name);
Thread.sleep(10000);
// if (!name.equals("New I/O worker #1")) {
logger.info("messageReceived thread-{} message:", Thread.currentThread().getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.nhn.pinpoint.common;

import java.util.HashMap;
import java.util.Map;
import com.nhn.pinpoint.common.util.apache.IntHashMap;

/**
* @author netspider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Map;

import com.nhn.pinpoint.common.util.RpcCodeRange;
import com.nhn.pinpoint.common.util.apache.IntHashMap;

/**
* @author emeroad
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public final class BytesUtils {
private static final String UTF8 = "UTF-8";
private static final Logger LOGGER = Logger.getLogger(BytesUtils.class.getName());

@Deprecated
public static byte[] longLongToBytes(final long value1, final long value2) {
final byte[] buffer = new byte[LONG_LONG_BYTE_LENGTH];
writeFirstLong0(value1, buffer);
writeSecondLong0(value2, buffer);
return buffer;
}

public static byte[] stringLongLongToBytes(final String string, final int maxStringSize, final long value1, final long value2) {
if (string == null) {
Expand Down Expand Up @@ -60,22 +53,6 @@ public static void writeBytes(final byte[] buffer, int offset, final byte[] stri
System.arraycopy(stringBytes, 0, buffer, offset, stringBytes.length);
}

@Deprecated
public static long[] bytesToLongLong(final byte[] buf) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
}
if (buf.length < LONG_LONG_BYTE_LENGTH) {
throw new IllegalArgumentException("Illegal buf size.");
}
final long[] result = new long[2];

result[0] = bytesToFirstLong0(buf);
result[1] = bytesToSecondLong0(buf);

return result;
}

public static long bytesToLong(final byte[] buf, final int offset) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
Expand Down Expand Up @@ -137,51 +114,6 @@ public static short bytesToShort(final byte byte1, final byte byte2) {
return (short) (((byte1 & 0xff) << 8) | ((byte2 & 0xff)));
}

public static long bytesToFirstLong(final byte[] buf) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
}
if (buf.length < LONG_BYTE_LENGTH) {
throw new IllegalArgumentException("buf.length is too small(8). buf.length:" + buf.length);
}

return bytesToFirstLong0(buf);
}

private static long bytesToFirstLong0(byte[] buf) {
final long rv = (((long) buf[0] & 0xff) << 56)
| (((long) buf[1] & 0xff) << 48)
| (((long) buf[2] & 0xff) << 40)
| (((long) buf[3] & 0xff) << 32)
| (((long) buf[4] & 0xff) << 24)
| (((long) buf[5] & 0xff) << 16)
| (((long) buf[6] & 0xff) << 8)
| (((long) buf[7] & 0xff));
return rv;
}

public static long bytesToSecondLong(final byte[] buf) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
}
if (buf.length < LONG_LONG_BYTE_LENGTH) {
throw new IllegalArgumentException("buf.length is too small(16). buf.length:" + buf.length);
}

return bytesToSecondLong0(buf);
}

private static long bytesToSecondLong0(final byte[] buf) {
final long rv = (((long) buf[8] & 0xff) << 56)
| (((long) buf[9] & 0xff) << 48)
| (((long) buf[10] & 0xff) << 40)
| (((long) buf[11] & 0xff) << 32)
| (((long) buf[12] & 0xff) << 24)
| (((long) buf[13] & 0xff) << 16)
| (((long) buf[14] & 0xff) << 8)
| (((long) buf[15] & 0xff));
return rv;
}

public static int writeLong(final long value, final byte[] buf, int offset) {
if (buf == null) {
Expand Down Expand Up @@ -284,30 +216,9 @@ public static int writeVar64(long value, final byte[] buf, int offset) {
}
}

@Deprecated
public static void writeFirstLong(final long value, final byte[] buf) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
}
if (buf.length < LONG_BYTE_LENGTH) {
throw new IllegalArgumentException("buf.length is too small(8). buf.length:" + buf.length);
}
writeFirstLong0(value, buf);
}

private static void writeFirstLong0(final long value, final byte[] buf) {
buf[0] = (byte) (value >> 56);
buf[1] = (byte) (value >> 48);
buf[2] = (byte) (value >> 40);
buf[3] = (byte) (value >> 32);
buf[4] = (byte) (value >> 24);
buf[5] = (byte) (value >> 16);
buf[6] = (byte) (value >> 8);
buf[7] = (byte) (value);
}

private static void writeFirstLong0(final long value, final byte[] buf, int offset) {
buf[0 + offset] = (byte) (value >> 56);
buf[offset] = (byte) (value >> 56);
buf[1 + offset] = (byte) (value >> 48);
buf[2 + offset] = (byte) (value >> 40);
buf[3 + offset] = (byte) (value >> 32);
Expand All @@ -317,32 +228,11 @@ private static void writeFirstLong0(final long value, final byte[] buf, int offs
buf[7 + offset] = (byte) (value);
}

@Deprecated
public static void writeSecondLong(final long value, final byte[] buf) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
}
if (buf.length < LONG_LONG_BYTE_LENGTH) {
throw new IllegalArgumentException("buf.length is too small(16). buf.length:" + buf.length);
}
writeSecondLong0(value, buf);
}


private static Logger getLogger() {
return Logger.getLogger(BytesUtils.class.getName());
}

private static void writeSecondLong0(final long value, final byte[] buf) {
buf[8] = (byte) (value >> 56);
buf[9] = (byte) (value >> 48);
buf[10] = (byte) (value >> 40);
buf[11] = (byte) (value >> 32);
buf[12] = (byte) (value >> 24);
buf[13] = (byte) (value >> 16);
buf[14] = (byte) (value >> 8);
buf[15] = (byte) (value);
}

private static void writeSecondLong0(final long value, final byte[] buf, int offset) {
buf[8 + offset] = (byte) (value >> 56);
Expand Down Expand Up @@ -459,14 +349,15 @@ public static long zigzagToLong(final long n) {
public static byte[] concat(final byte[]... arrays) {
int totalLength = 0;

for (int i = 0; i < arrays.length; i++) {
final int length = arrays.length;
for (int i = 0; i < length; i++) {
totalLength += arrays[i].length;
}

byte[] result = new byte[totalLength];

int currentIndex = 0;
for (int i = 0; i < arrays.length; i++) {
for (int i = 0; i < length; i++) {
System.arraycopy(arrays[i], 0, result, currentIndex, arrays[i].length);
currentIndex += arrays[i].length;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import java.lang.management.RuntimeMXBean;
import java.util.Map;

import com.nhn.pinpoint.common.SystemPropertyKey;
import com.nhn.pinpoint.common.JvmVersion;

/**
* @author hyungil.jeong
*/
Expand Down
Loading

0 comments on commit 26cbadd

Please sign in to comment.