Search in sources :

Example 1 with ProfileFactory

use of com.creditease.uav.profiling.spi.ProfileFactory in project uavstack by uavorg.

the class AppProfilingListener method handleEvent.

@Override
public void handleEvent(InterceptContext context) {
    // get the context path
    String contextpath = (String) context.get(InterceptConstants.CONTEXTPATH);
    String basepath = (String) context.get(InterceptConstants.BASEPATH);
    // swtich event
    Event event = context.getEvent();
    // create the profile context object
    ProfileContext profilecontext = new StandardProfileContext();
    // put InterceptContext into profile context, then profile handler can get info from InterceptContext
    profilecontext.put(InterceptContext.class, context);
    // get the profile factory
    ProfileFactory pf = ProfileFactory.instance();
    switch(event) {
        case AFTER_SERVET_INIT:
            break;
        case BEFORE_SERVLET_DESTROY:
            break;
        case WEBCONTAINER_STARTED:
            startProfiling(contextpath, basepath, pf, profilecontext);
            break;
        case WEBCONTAINER_STOPPED:
            stopProfiling(contextpath, basepath, pf);
            break;
        default:
            break;
    }
}
Also used : StandardProfileContext(com.creditease.uav.profiling.StandardProfileContext) ProfileContext(com.creditease.uav.profiling.spi.ProfileContext) ProfileFactory(com.creditease.uav.profiling.spi.ProfileFactory) Event(com.creditease.monitor.interceptframework.spi.InterceptContext.Event) StandardProfileContext(com.creditease.uav.profiling.StandardProfileContext)

Aggregations

Event (com.creditease.monitor.interceptframework.spi.InterceptContext.Event)1 StandardProfileContext (com.creditease.uav.profiling.StandardProfileContext)1 ProfileContext (com.creditease.uav.profiling.spi.ProfileContext)1 ProfileFactory (com.creditease.uav.profiling.spi.ProfileFactory)1