/**
  * Login method which can be used by the security system to replace the existing {@link
  * BasicEventContext}.
  */
 public void login(BasicEventContext bec) {
   if (log.isDebugEnabled()) {
     log.debug("Logging in :" + bec);
   }
   list().add(bec);
   bec.getStats().methodIn();
 }
 public int logout() {
   LinkedList<BasicEventContext> list = list();
   BasicEventContext bec = list.removeLast();
   bec.getStats().methodOut();
   if (log.isDebugEnabled()) {
     log.debug("Logged out: " + bec);
   }
   return list.size();
 }