use of com.navercorp.pinpoint.rpc.PinpointSocket in project pinpoint by naver.
the class CollectorClusterConnectionManager method disconnectPoint.
public void disconnectPoint(SocketAddress address) {
logger.info("localhost -> {} disconnect started.", address);
PinpointSocket socket = socketRepository.remove(address);
if (socket != null) {
socket.close();
logger.info("localhost -> {} disconnect completed.", address);
} else {
logger.info("localhost -> {} already disconnected.", address);
}
}
use of com.navercorp.pinpoint.rpc.PinpointSocket in project pinpoint by naver.
the class AgentServiceImpl method openStream.
@Override
public ClientStreamChannelContext openStream(AgentInfo agentInfo, byte[] payload, ClientStreamChannelMessageListener messageListener, StreamChannelStateChangeEventHandler<ClientStreamChannel> stateChangeListener) throws TException {
TCommandTransfer transferObject = createCommandTransferObject(agentInfo, payload);
PinpointSocket socket = clusterManager.getSocket(agentInfo);
if (socket != null) {
return socket.openStream(serializeRequest(transferObject), messageListener, stateChangeListener);
}
return null;
}
use of com.navercorp.pinpoint.rpc.PinpointSocket in project pinpoint by naver.
the class TcpDataSenderTest method serverStart.
@Before
public void serverStart() {
serverAcceptor = new PinpointServerAcceptor();
serverAcceptor.setMessageListener(new ServerMessageListener() {
@Override
public void handleSend(SendPacket sendPacket, PinpointSocket pinpointSocket) {
logger.debug("handleSend packet:{}, remote:{}", sendPacket, pinpointSocket.getRemoteAddress());
if (sendLatch != null) {
sendLatch.countDown();
}
}
@Override
public void handleRequest(RequestPacket requestPacket, PinpointSocket pinpointSocket) {
logger.debug("handleRequest packet:{}, remote:{}", requestPacket, pinpointSocket.getRemoteAddress());
}
@Override
public HandshakeResponseCode handleHandshake(Map arg0) {
return HandshakeResponseType.Success.DUPLEX_COMMUNICATION;
}
@Override
public void handlePing(PingPacket pingPacket, PinpointServer pinpointServer) {
logger.debug("ping received {} {} ", pingPacket, pinpointServer);
}
});
serverAcceptor.bind(HOST, PORT);
}
use of com.navercorp.pinpoint.rpc.PinpointSocket in project pinpoint by naver.
the class TcpDataSenderReconnectTest method serverAcceptorStart.
public PinpointServerAcceptor serverAcceptorStart() {
PinpointServerAcceptor serverAcceptor = new PinpointServerAcceptor();
serverAcceptor.setMessageListener(new ServerMessageListener() {
@Override
public void handleSend(SendPacket sendPacket, PinpointSocket pinpointSocket) {
logger.debug("handleSend packet:{}, remote:{}", sendPacket, pinpointSocket.getRemoteAddress());
send++;
}
@Override
public void handleRequest(RequestPacket requestPacket, PinpointSocket pinpointSocket) {
logger.debug("handleRequest packet:{}, remote:{}", requestPacket, pinpointSocket.getRemoteAddress());
}
@Override
public HandshakeResponseCode handleHandshake(Map properties) {
return HandshakeResponseType.Success.DUPLEX_COMMUNICATION;
}
@Override
public void handlePing(PingPacket pingPacket, PinpointServer pinpointServer) {
logger.debug("ping received {} {} ", pingPacket, pinpointServer);
}
});
serverAcceptor.bind(HOST, PORT);
return serverAcceptor;
}
use of com.navercorp.pinpoint.rpc.PinpointSocket in project pinpoint by naver.
the class TCPReceiver method start.
@PostConstruct
public void start() {
afterPropertiesSet();
// take care when attaching message handlers as events are generated from the IO thread.
// pass them to a separate queue and handle them in a different thread.
this.serverAcceptor.setMessageListener(new ServerMessageListener() {
@Override
public HandshakeResponseCode handleHandshake(Map properties) {
if (properties == null) {
return HandshakeResponseType.ProtocolError.PROTOCOL_ERROR;
}
boolean hasRequiredKeys = HandshakePropertyType.hasRequiredKeys(properties);
if (!hasRequiredKeys) {
return HandshakeResponseType.PropertyError.PROPERTY_ERROR;
}
boolean supportServer = MapUtils.getBoolean(properties, HandshakePropertyType.SUPPORT_SERVER.getName(), true);
if (supportServer) {
return HandshakeResponseType.Success.DUPLEX_COMMUNICATION;
} else {
return HandshakeResponseType.Success.SIMPLEX_COMMUNICATION;
}
}
@Override
public void handleSend(SendPacket sendPacket, PinpointSocket pinpointSocket) {
receive(sendPacket, pinpointSocket);
}
@Override
public void handleRequest(RequestPacket requestPacket, PinpointSocket pinpointSocket) {
requestResponse(requestPacket, pinpointSocket);
}
@Override
public void handlePing(PingPacket pingPacket, PinpointServer pinpointServer) {
recordPing(pingPacket, pinpointServer);
}
});
this.serverAcceptor.bind(configuration.getTcpListenIp(), configuration.getTcpListenPort());
}
Aggregations