Examples of TimerContext


Examples of com.yammer.metrics.core.TimerContext

    private static final com.yammer.metrics.core.Timer putTimer =
            Metrics.newTimer(InterceptedByNameResource.class, "puts", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

    @POST
    public String echo(final String text) {
        final TimerContext timer = postTimer.time();
        try {
            return text;
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

    private static final com.yammer.metrics.core.Timer putTimer =
            Metrics.newTimer(DynamicallyBoundInterceptorResource.class, "puts", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

    @POST
    public String echo(final String text) {
        final TimerContext timer = postTimer.time();
        try {
            return text;
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        }
    }

    @PUT
    public void put(final String text) {
        final TimerContext timer = putTimer.time();
        timer.stop();
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        }
    }

    @PUT
    public void put(final String text) {
        final TimerContext timer = putTimer.time();
        timer.stop();
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        timer.stop();
    }

    @GET
    public String get() {
        final TimerContext timer = getTimer.time();
        try {
            return "text";
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        timer.stop();
    }

    @GET
    public String get() {
        final TimerContext timer = getTimer.time();
        try {
            return "text";
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext


        builder.addMethod("GET").produces(config.getType()).handledBy(new Inflector<ContainerRequestContext, Object>() {
            @Override
            public Response apply(ContainerRequestContext containerRequestContext) {
                TimerContext timer = getTimer.time();
                try {
                    Object entity;
                    if (config.getFile() != null) {
                        entity = JerseyApp.class.getClassLoader().getResourceAsStream(config.getFile().getName());
                    } else {
                        if (isText) {
                            entity = "text";
                        } else {
                            entity = PERSON;
                        }
                    }

                    return Response.ok().entity(entity).build();
                } finally {
                    timer.stop();
                }
            }
        });

        builder.addMethod("POST").consumes(config.getType()).produces(config.getType()).handledBy(new Inflector<ContainerRequestContext, Object>() {
            @Override
            public Response apply(ContainerRequestContext containerRequestContext) {
                TimerContext timer = postTimer.time();
                try {
                    final Object entity = ((ContainerRequest) containerRequestContext).readEntity(isText ? String.class : Person.class);
                    return Response.ok().entity(entity).build();
                } finally {
                    timer.stop();
                }

            }
        });

        builder.addMethod("PUT").consumes(config.getType()).produces(config.getType()).handledBy(new Inflector<ContainerRequestContext, Object>() {
            @Override
            public Response apply(ContainerRequestContext containerRequestContext) {
                TimerContext timer = putTimer.time();
                try {
                    // read entity in order to test performance of MBR
                    ((ContainerRequest) containerRequestContext).readEntity(isText ? String.class : Person.class);
                    return Response.noContent().build();
                } finally {
                    timer.stop();
                }
            }
        });

View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

    private static final com.yammer.metrics.core.Timer putTimer =
            Metrics.newTimer(NameBoundFilterResource.class, "puts", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

    @POST
    public String echo(final String text) {
        final TimerContext timer = postTimer.time();
        try {
            return text;
        } finally {
            timer.stop();
        }
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        }
    }

    @PUT
    public void put(final String text) {
        final TimerContext timer = putTimer.time();
        timer.stop();
    }
View Full Code Here

Examples of com.yammer.metrics.core.TimerContext

        timer.stop();
    }

    @GET
    public String get() {
        final TimerContext timer = getTimer.time();
        try {
            return "text";
        } finally {
            timer.stop();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.