title: EJB @Lock not working as expected
body: <p>I have a scheduled EJB which calls a Singleton EJB. For some reason the scheduled method executes twice on every schedule (something to do with it being referenced from a WAR file as well as in the EAR). To counter this I have put the <code>@Lock</code> annotation on the method in the <code>@Singleton</code> bean, but it still get executed twice concurrently:</p>
  
  <pre><code>@Stateless
  public class PaymoTimer {
      @EJB
      private IPaymoManagerRemote manager;
  
      @Schedule(hour = "10,12,14,16", minute = "41", second = "0", info = "PaymoTimer")
      public void timer() throws Exception {
          manager.generateEmailReport();
      }
  }
  
  
  @LocalBean
  @Singleton
  public class PaymoManager implements IPaymoManagerRemote {
      @Override
      @Lock(LockType.WRITE)
      public void generateEmailReport() {
          System.out.println("generateEmailReport");
          String text = getDailySummaryForUser();
          System.out.println("done");
      }
  }
  </code></pre>
  
  <p>My console prints out the following:</p>
  
  <pre><code>12:42:00,008 INFO  [stdout] (EJB default - 10) generateEmailReport
  12:42:00,009 INFO  [stdout] (EJB default - 9) generateEmailReport
  12:42:24,027 INFO  [stdout] (EJB default - 10) done
  12:42:24,323 INFO  [stdout] (EJB default - 9) done
  </code></pre>
  
  <p>Looking at the times and the process ID it is clear that the method is getting called while a previous instance is still running.</p>
  
  <p>Am I misunderstanding what the <code>@Lock</code> annotation is meant to do?</p>