Search in sources :

Example 1 with DefaultPinpointClientFactory

use of com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory in project pinpoint by naver.

the class PinpointClientFactoryProvider method get.

public PinpointClientFactory get() {
    PinpointClientFactory pinpointClientFactory = new DefaultPinpointClientFactory();
    pinpointClientFactory.setTimeoutMillis(1000 * 5);
    AgentInformation agentInformation = this.agentInformation.get();
    Map<String, Object> properties = toMap(agentInformation);
    boolean isSupportServerMode = profilerConfig.isTcpDataSenderCommandAcceptEnable();
    if (isSupportServerMode) {
        pinpointClientFactory.setMessageListener(commandDispatcher);
        pinpointClientFactory.setServerStreamChannelMessageListener(commandDispatcher);
        properties.put(HandshakePropertyType.SUPPORT_SERVER.getName(), true);
        properties.put(HandshakePropertyType.SUPPORT_COMMAND_LIST.getName(), commandDispatcher.getRegisteredCommandServiceCodes());
    } else {
        properties.put(HandshakePropertyType.SUPPORT_SERVER.getName(), false);
    }
    pinpointClientFactory.setProperties(properties);
    return pinpointClientFactory;
}
Also used : DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) AgentInformation(com.navercorp.pinpoint.profiler.AgentInformation)

Example 2 with DefaultPinpointClientFactory

use of com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory in project pinpoint by naver.

the class DataReceiverGroupTest method createPinpointClientFactory.

private PinpointClientFactory createPinpointClientFactory() {
    PinpointClientFactory clientFactory = new DefaultPinpointClientFactory();
    clientFactory.setWriteTimeoutMillis(1000 * 3);
    clientFactory.setRequestTimeoutMillis(1000 * 5);
    clientFactory.setProperties(Collections.emptyMap());
    return clientFactory;
}
Also used : DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)

Example 3 with DefaultPinpointClientFactory

use of com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory in project pinpoint by naver.

the class AgentInfoSenderTest method createPinpointClientFactory.

private PinpointClientFactory createPinpointClientFactory() {
    PinpointClientFactory clientFactory = new DefaultPinpointClientFactory();
    clientFactory.setWriteTimeoutMillis(1000 * 3);
    clientFactory.setRequestTimeoutMillis(1000 * 5);
    clientFactory.setProperties(Collections.<String, Object>emptyMap());
    return clientFactory;
}
Also used : DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)

Example 4 with DefaultPinpointClientFactory

use of com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory in project pinpoint by naver.

the class ClassPreLoader method preload.

public static void preload(int port) {
    PinpointServerAcceptor serverAcceptor = null;
    PinpointClient client = null;
    PinpointClientFactory clientFactory = null;
    try {
        serverAcceptor = new PinpointServerAcceptor();
        serverAcceptor.bind("127.0.0.1", port);
        clientFactory = new DefaultPinpointClientFactory();
        client = clientFactory.connect("127.0.0.1", port);
        client.sendSync(new byte[0]);
    } catch (Exception ex) {
        System.err.print("preLoad error Caused:" + ex.getMessage());
        ex.printStackTrace();
        final Logger logger = LogManager.getLogger(ClassPreLoader.class);
        logger.warn("preLoad error Caused:{}", ex.getMessage(), ex);
        if (ex instanceof PinpointSocketException) {
            throw (PinpointSocketException) ex;
        } else {
            throw new PinpointSocketException(ex.getMessage(), ex);
        }
    } finally {
        if (client != null) {
            try {
                client.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (clientFactory != null) {
            try {
                clientFactory.release();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (serverAcceptor != null) {
            try {
                serverAcceptor.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
Also used : DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClient(com.navercorp.pinpoint.rpc.client.PinpointClient) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) PinpointServerAcceptor(com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor) Logger(org.apache.logging.log4j.Logger)

Example 5 with DefaultPinpointClientFactory

use of com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory in project pinpoint by naver.

the class StatClientFactoryProvider method get.

public PinpointClientFactory get() {
    if (!"TCP".equalsIgnoreCase(thriftTransportConfig.getStatDataSenderTransportType())) {
        return null;
    }
    PinpointClientFactory pinpointClientFactory = new DefaultPinpointClientFactory(channelFactoryProvider.get(), connectTimerProvider.get());
    pinpointClientFactory.setWriteTimeoutMillis(1000 * 3);
    pinpointClientFactory.setRequestTimeoutMillis(1000 * 5);
    int writeBufferHighWaterMark = getByteSize(thriftTransportConfig.getStatDataSenderWriteBufferHighWaterMark(), ByteSizeUnit.MEGA_BYTES.toBytesSizeAsInt(16));
    int writeBufferLowWaterMark = getByteSize(thriftTransportConfig.getStatDataSenderWriteBufferLowWaterMark(), ByteSizeUnit.MEGA_BYTES.toBytesSizeAsInt(8));
    if (writeBufferLowWaterMark > writeBufferHighWaterMark) {
        logger.warn("must be writeBufferHighWaterMark({}) >= writeBufferLowWaterMark({})", writeBufferHighWaterMark, writeBufferLowWaterMark);
        writeBufferLowWaterMark = writeBufferHighWaterMark;
    }
    pinpointClientFactory.setWriteBufferHighWaterMark(writeBufferHighWaterMark);
    pinpointClientFactory.setWriteBufferLowWaterMark(writeBufferLowWaterMark);
    return pinpointClientFactory;
}
Also used : DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory)

Aggregations

DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)13 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)11 AgentInformation (com.navercorp.pinpoint.profiler.AgentInformation)2 PinpointClient (com.navercorp.pinpoint.rpc.client.PinpointClient)1 ClusterOption (com.navercorp.pinpoint.rpc.cluster.ClusterOption)1 PinpointServerAcceptor (com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor)1 HashMap (java.util.HashMap)1 Logger (org.apache.logging.log4j.Logger)1