Search in sources :

Example 1 with ListenableAsyncState

use of com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState in project pinpoint by naver.

the class ListenableAsyncStateTest method close_setup.

@Test
public void close_setup() throws Exception {
    SpanAsyncStateListener mock = mock(SpanAsyncStateListener.class);
    ListenableAsyncState listenableAsyncState = new ListenableAsyncState(mock);
    listenableAsyncState.setup();
    listenableAsyncState.finish();
    verify(mock, times(0)).finish();
}
Also used : ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) Test(org.junit.Test)

Example 2 with ListenableAsyncState

use of com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState in project pinpoint by naver.

the class ListenableAsyncStateTest method close_await.

@Test
public void close_await() throws Exception {
    SpanAsyncStateListener mock = mock(SpanAsyncStateListener.class);
    ListenableAsyncState listenableAsyncState = new ListenableAsyncState(mock);
    listenableAsyncState.await();
    listenableAsyncState.finish();
    verify(mock, times(0)).finish();
}
Also used : ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) Test(org.junit.Test)

Example 3 with ListenableAsyncState

use of com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState in project pinpoint by naver.

the class ListenableAsyncStateTest method close.

@Test
public void close() throws Exception {
    SpanAsyncStateListener mock = mock(SpanAsyncStateListener.class);
    ListenableAsyncState listenableAsyncState = new ListenableAsyncState(mock);
    listenableAsyncState.setup();
    listenableAsyncState.await();
    listenableAsyncState.finish();
    verify(mock, times(1)).finish();
}
Also used : ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) Test(org.junit.Test)

Example 4 with ListenableAsyncState

use of com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState in project pinpoint by naver.

the class DefaultBaseTraceFactory method continueAsyncTraceObject.

// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace continueAsyncTraceObject(final TraceId traceId) {
    final Storage storage = storageFactory.createStorage();
    final long localTransactionId = this.idGenerator.nextContinuedTransactionId();
    final DefaultTrace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
    final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(trace.getSpan(), storageFactory.createStorage());
    final ListenableAsyncState stateListener = new ListenableAsyncState(asyncStateListener);
    final AsyncTrace asyncTrace = new AsyncTrace(trace, stateListener);
    return asyncTrace;
}
Also used : AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)

Example 5 with ListenableAsyncState

use of com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState in project pinpoint by naver.

the class DefaultBaseTraceFactory method newAsyncTraceObject.

// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace newAsyncTraceObject() {
    final boolean sampling = sampler.isSampling();
    if (sampling) {
        final Storage storage = storageFactory.createStorage();
        final TraceId traceId = traceIdFactory.newTraceId();
        final long localTransactionId = traceId.getTransactionSequence();
        final DefaultTrace trace = new DefaultTrace(callStackFactory, storage, traceId, localTransactionId, asyncIdGenerator, true, spanFactory, recorderFactory);
        final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(trace.getSpan(), storageFactory.createStorage());
        final AsyncState closer = new ListenableAsyncState(asyncStateListener);
        final AsyncTrace asyncTrace = new AsyncTrace(trace, closer);
        return asyncTrace;
    } else {
        return newDisableTrace();
    }
}
Also used : AsyncStorage(com.navercorp.pinpoint.profiler.context.storage.AsyncStorage) Storage(com.navercorp.pinpoint.profiler.context.storage.Storage) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState) AsyncState(com.navercorp.pinpoint.bootstrap.context.AsyncState) TraceId(com.navercorp.pinpoint.bootstrap.context.TraceId) AsyncTraceId(com.navercorp.pinpoint.bootstrap.context.AsyncTraceId) ListenableAsyncState(com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)

Aggregations

ListenableAsyncState (com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)5 Test (org.junit.Test)3 AsyncStorage (com.navercorp.pinpoint.profiler.context.storage.AsyncStorage)2 Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)2 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)1 AsyncTraceId (com.navercorp.pinpoint.bootstrap.context.AsyncTraceId)1 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)1