use of com.navercorp.pinpoint.rpc.packet.stream.StreamCreateFailPacket in project pinpoint by naver.
the class ActiveThreadCountWorker method active0.
private boolean active0(AgentInfo agentInfo) {
synchronized (lock) {
boolean active = false;
try {
ClientStreamChannelContext clientStreamChannelContext = agentService.openStream(agentInfo, COMMAND_INSTANCE, messageListener, stateChangeListener);
if (clientStreamChannelContext == null) {
setDefaultErrorMessage(StreamCode.CONNECTION_NOT_FOUND.name());
workerActiveManager.addReactiveWorker(agentInfo);
} else {
if (clientStreamChannelContext.getCreateFailPacket() == null) {
streamChannel = clientStreamChannelContext.getStreamChannel();
setDefaultErrorMessage(TRouteResult.TIMEOUT.name());
active = true;
} else {
StreamCreateFailPacket createFailPacket = clientStreamChannelContext.getCreateFailPacket();
setDefaultErrorMessage(createFailPacket.getCode().name());
}
}
} catch (TException exception) {
setDefaultErrorMessage(TRouteResult.NOT_SUPPORTED_REQUEST.name());
}
return active;
}
}
use of com.navercorp.pinpoint.rpc.packet.stream.StreamCreateFailPacket in project pinpoint by naver.
the class StreamChannelManagerTest method streamClosedTest1.
@Test
public void streamClosedTest1() throws IOException, InterruptedException {
PinpointServerAcceptor serverAcceptor = createServerFactory(SimpleServerMessageListener.DUPLEX_ECHO_INSTANCE, null);
serverAcceptor.bind("localhost", bindPort);
PinpointClientFactory clientFactory = createSocketFactory();
try {
PinpointClient client = clientFactory.connect("127.0.0.1", bindPort);
RecordedStreamChannelMessageListener clientListener = new RecordedStreamChannelMessageListener(4);
ClientStreamChannelContext clientContext = client.openStream(new byte[0], clientListener);
StreamCreateFailPacket createFailPacket = clientContext.getCreateFailPacket();
if (createFailPacket == null) {
Assert.fail();
}
clientContext.getStreamChannel().close();
PinpointRPCTestUtils.close(client);
} finally {
clientFactory.release();
PinpointRPCTestUtils.close(serverAcceptor);
}
}
Aggregations