public void onAcctStarted(SessionExpiredEvent event) {
   JRadiusSession session = event.getSession();
   String error = "Session Expired in Accounting-Started state, Accounting never stopped";
   RadiusLog.warn(session.getSessionKey() + ": " + error);
   JRadiusLogEntry logEntry = session.getLogEntry(event, "0");
   logEntry.setType("error");
   logEntry.addMessage(error);
 }
 public void onAuthAccepted(SessionExpiredEvent event) {
   JRadiusSession session = event.getSession();
   String error = "Session Expired in Auth-Accepted state, Accounting never started";
   RadiusLog.warn(session.getSessionKey() + ": " + error);
   JRadiusLogEntry logEntry = session.getLogEntry(event, "0");
   logEntry.setType("error");
   logEntry.addMessage(error);
   session.commitLogEntries(JRadiusServer.RLM_MODULE_FAIL);
 }
 public void onRadiusError(SessionExpiredEvent event) {
   JRadiusSession session = event.getSession();
   String error = "Session Expired in Error State";
   RadiusLog.error(session.getSessionKey() + ": " + error);
   JRadiusLogEntry logEntry = session.getLogEntry(event, "0");
   logEntry.setType("error");
   logEntry.addMessage(error);
   session.commitLogEntries(JRadiusServer.RLM_MODULE_FAIL);
 }
  /* (non-Javadoc)
   * @see net.jradius.handler.EventHandler#handle(net.jradius.server.JRadiusEvent)
   */
  public boolean handle(JRadiusEvent evt) throws Exception {
    if (evt instanceof SessionExpiredEvent) {
      SessionExpiredEvent event = (SessionExpiredEvent) evt;
      JRadiusSession session = event.getSession();
      if (session == null) return true;

      RadiusLog.debug("Processing Session Expired Event for Session: " + session.getSessionKey());

      if (session.getSessionState() == JRadiusSession.RADIUS_ERROR) {
        onRadiusError(event);
      } else if ((session.getSessionState() & JRadiusSession.ACCT_STOPPED) != 0) {
        onAcctStopped(event);
      } else if ((session.getSessionState() & JRadiusSession.ACCT_STARTED) != 0) {
        onAcctStarted(event);
      } else if ((session.getSessionState() & JRadiusSession.AUTH_REJECTED) != 0) {
        onAuthRejected(event);
      } else if ((session.getSessionState() & JRadiusSession.AUTH_ACCEPTED) != 0) {
        Long serviceType = session.getServiceType();
        if (serviceType != null) {
          int iServiceType = serviceType.intValue();
          if (iServiceType != 6
              && // Administrative-User
              iServiceType != 8) // Authenticate-Only
          {
            onAuthAccepted(event);
          }
        }
      } else if ((session.getSessionState() & JRadiusSession.AUTH_REJECTED) != 0) {
        onAuthPending(event);
      }

      return true;
    }
    return false;
  }