@Override
    public void close() {
        synchronized (agentStatusLock) {
            if (this.agentStatus == AgentStatus.RUNNING) {
                changeStatus(AgentStatus.STOPPED);
            } else {
                logger.warn("Cannot stop agent. Current status = [{}]", this.agentStatus);
                return;
            }
        }
        logger.info("Stopping pinpoint Agent.");
        this.applicationContext.close();

        // for testcase
        if (agentOption.isStaticResourceCleanup()) {
            this.loggingSystem.close();
        }
    }
@author emeroad
@author koo.taejin
@author hyungil.jeong
agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/DefaultAgent.java