// Path: src/main/java/org/msgpack/rpc/dispatcher/StopWatchDispatcher.java
// public class StopWatchDispatcher implements Dispatcher {
// 
//     Dispatcher innerDispatcher;
// 
//     private final static Logger logger = LoggerFactory.getLogger(StopWatchDispatcher.class);
// 
//     private boolean verbose = true;
// 
//     public boolean isVerbose() {
//         return verbose;
//     }
// 
//     public void setVerbose(boolean verbose) {
//         this.verbose = verbose;
//     }
// 
//     public StopWatchDispatcher(Dispatcher inner) {
//         this.innerDispatcher = inner;
//     }
// 
//     public void dispatch(Request request) throws Exception {
//         if(verbose){
//             logger.info(String.format( "Begin dispatching %s with args %s",request.getMethodName(),request.getArguments().toString()));
//         }
//         long start = System.currentTimeMillis();
//         try{
//             innerDispatcher.dispatch(request);
//             long diff = System.currentTimeMillis() - start;
//             logger.info(String.format("Dispatch %s in %s msecs",request.getMethodName(),diff));
//         }catch(Exception e){
//             long diff = System.currentTimeMillis() - start;
//             logger.info(String.format("%s : %s while dispatching %s,(in %s msecs)",e.getClass().getSimpleName(), e.getMessage(), request.getMethodName(),diff));
//             throw e;
//         }
//     }
// }


import org.msgpack.MessagePack;
import org.msgpack.rpc.dispatcher.Dispatcher;
import org.msgpack.rpc.dispatcher.StopWatchDispatcher;
package org.msgpack.rpc.builder;


/**
 * User: takeshita
 * Create: 12/06/15 1:23
 */
public class StopWatchDispatcherBuilder implements DispatcherBuilder {

    protected DispatcherBuilder baseBuilder;
    protected boolean verbose = false;

    public boolean isVerbose() {
        return verbose;
    }

    public void setVerbose(boolean verbose) {
        this.verbose = verbose;
    }

    public StopWatchDispatcherBuilder withVerboseOutput(boolean verbose){
        this.verbose = verbose;
        return this;
    }

    public StopWatchDispatcherBuilder(DispatcherBuilder baseBuilder){
        this.baseBuilder = baseBuilder;
    }

    public Dispatcher decorate(Dispatcher innerDispatcher) {
// Path: src/main/java/org/msgpack/rpc/dispatcher/StopWatchDispatcher.java
// public class StopWatchDispatcher implements Dispatcher {
// 
//     Dispatcher innerDispatcher;
// 
//     private final static Logger logger = LoggerFactory.getLogger(StopWatchDispatcher.class);
// 
//     private boolean verbose = true;
// 
//     public boolean isVerbose() {
//         return verbose;
//     }
// 
//     public void setVerbose(boolean verbose) {
//         this.verbose = verbose;
//     }
// 
//     public StopWatchDispatcher(Dispatcher inner) {
//         this.innerDispatcher = inner;
//     }
// 
//     public void dispatch(Request request) throws Exception {
//         if(verbose){
//             logger.info(String.format( "Begin dispatching %s with args %s",request.getMethodName(),request.getArguments().toString()));
//         }
//         long start = System.currentTimeMillis();
//         try{
//             innerDispatcher.dispatch(request);
//             long diff = System.currentTimeMillis() - start;
//             logger.info(String.format("Dispatch %s in %s msecs",request.getMethodName(),diff));
//         }catch(Exception e){
//             long diff = System.currentTimeMillis() - start;
//             logger.info(String.format("%s : %s while dispatching %s,(in %s msecs)",e.getClass().getSimpleName(), e.getMessage(), request.getMethodName(),diff));
//             throw e;
//         }
//     }
// }


// Path: src/main/java/org/msgpack/rpc/builder/StopWatchDispatcherBuilder.java
import org.msgpack.MessagePack;
import org.msgpack.rpc.dispatcher.Dispatcher;
import org.msgpack.rpc.dispatcher.StopWatchDispatcher;

package org.msgpack.rpc.builder;


/**
 * User: takeshita
 * Create: 12/06/15 1:23
 */
public class StopWatchDispatcherBuilder implements DispatcherBuilder {

    protected DispatcherBuilder baseBuilder;
    protected boolean verbose = false;

    public boolean isVerbose() {
        return verbose;
    }

    public void setVerbose(boolean verbose) {
        this.verbose = verbose;
    }

    public StopWatchDispatcherBuilder withVerboseOutput(boolean verbose){
        this.verbose = verbose;
        return this;
    }

    public StopWatchDispatcherBuilder(DispatcherBuilder baseBuilder){
        this.baseBuilder = baseBuilder;
    }

    public Dispatcher decorate(Dispatcher innerDispatcher) {
        StopWatchDispatcher disp = new StopWatchDispatcher(innerDispatcher);