/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.aspects.concurrent;

import java.util.concurrent.CountDownLatch;

/**
 * comment
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 */
public class LatchedObjectMixin implements LatchedObject
{
   private CountDownLatch latch;

   public LatchedObjectMixin(Object obj)
   {
      Latched l = obj.getClass().getAnnotation(Latched.class);
      latch = new CountDownLatch(l.countdown());
   }
   public CountDownLatch getLatch()
   {
      return latch;
   }

   public void resetLatch(int count)
   {
      latch = new CountDownLatch(count);
   }
}
