mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-26 05:06:34 +10:00
[유치수] [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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user