[유치수] [NOBTS] initial imports

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@423 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Chisu Yu
2012-06-19 05:51:25 +00:00
parent 20c9d38b03
commit 3be294bc76
62 changed files with 8649 additions and 0 deletions
@@ -0,0 +1,34 @@
package com.profiler.sender;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
public abstract class AbstractDataSender {
public void send() {
try {
byte [] sendData=getSendData();
int sendDataLength=sendData.length;
// System.out.println("sendDataLength="+sendDataLength);
InetSocketAddress address=getAddress();
DatagramPacket packet=new DatagramPacket(sendData,sendDataLength,address);
DatagramSocket udpSocket=new DatagramSocket();
// System.out.println("sendBufferSize="+udpSocket.getSendBufferSize());
udpSocket.send(packet);
// if(this instanceof RequestDataSender || this instanceof RequestTransactionDataSender ) {
// System.out.println(this.getClass().getName()+" Send bufferSize="+udpSocket.getSendBufferSize()+" dataLength="+sendDataLength);
// }
udpSocket.close();
} catch(Exception e) {
e.printStackTrace();
}
}
protected abstract byte[] getSendData() throws Exception;
protected abstract InetSocketAddress getAddress() throws Exception;
public void log(String message) {
// System.out.println("[AbstractDataSenderThread] "+message);
}
}