Search in sources :

Example 1 with UdpDataSender

use of com.navercorp.pinpoint.profiler.sender.UdpDataSender in project pinpoint by naver.

the class UdpDataSenderTest method sendAndFlushCheck.

@Test
public void sendAndFlushCheck() throws InterruptedException {
    UdpDataSender sender = new UdpDataSender("localhost", PORT, "test", 128, 1000, 1024 * 64 * 100);
    TAgentInfo agentInfo = new TAgentInfo();
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.send(agentInfo);
    sender.stop();
}
Also used : UdpDataSender(com.navercorp.pinpoint.profiler.sender.UdpDataSender) TAgentInfo(com.navercorp.pinpoint.thrift.dto.TAgentInfo) Test(org.junit.Test)

Example 2 with UdpDataSender

use of com.navercorp.pinpoint.profiler.sender.UdpDataSender in project pinpoint by naver.

the class UdpDataSenderTest method sendMessage_getLimit.

private boolean sendMessage_getLimit(TBase tbase, long waitTimeMillis) throws InterruptedException {
    final AtomicBoolean limitCounter = new AtomicBoolean(false);
    final CountDownLatch latch = new CountDownLatch(1);
    UdpDataSender sender = new UdpDataSender("localhost", PORT, "test", 128, 1000, 1024 * 64 * 100) {

        @Override
        protected boolean isLimit(int interBufferSize) {
            boolean limit = super.isLimit(interBufferSize);
            limitCounter.set(limit);
            latch.countDown();
            return limit;
        }
    };
    try {
        sender.send(tbase);
        latch.await(waitTimeMillis, TimeUnit.MILLISECONDS);
    } finally {
        sender.stop();
    }
    return limitCounter.get();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CountDownLatch(java.util.concurrent.CountDownLatch) UdpDataSender(com.navercorp.pinpoint.profiler.sender.UdpDataSender)

Aggregations

UdpDataSender (com.navercorp.pinpoint.profiler.sender.UdpDataSender)2 TAgentInfo (com.navercorp.pinpoint.thrift.dto.TAgentInfo)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Test (org.junit.Test)1