It's probably easier to wrap it in an ExecutorService and then use that to
shut it down.


On Mon, Jun 3, 2013 at 8:03 AM, Pablo Fernandez <notifications@github.com>wrote:

> In
> metrics-core/src/test/java/com/codahale/metrics/InstrumentedThreadFactoryTest.java:
>
> > +    public void reportsThreadInformation() throws Exception {
> > +        Runnable fastOne = new FastRunnable();
> > +        Runnable slowOne = new SlowRunnable();
> > +        Counter created = registry.counter("factory.created");
> > +        Counter running = registry.counter("factory.running");
> > +        Counter finished = registry.counter("factory.finished");
> > +
> > +        Thread fastThread = instrumentedFactory.newThread(fastOne);
> > +        Thread slowThread = instrumentedFactory.newThread(slowOne);
> > +
> > +        assertThat(created.getCount()).isEqualTo(2);
> > +        assertThat(running.getCount()).isEqualTo(0);
> > +        assertThat(finished.getCount()).isEqualTo(0);
> > +
> > +        fastThread.start();
> > +        slowThread.start();
>
> Is calling interrupt on them in a tearDown method enough? should I mark
> them as daemon too?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/codahale/metrics/pull/411/files#r4501420>
> .
>



-- 
Coda Hale
http://codahale.com