code: @Override
      public synchronized void setFlags(final Flags flag, final boolean set) throws MessagingException {
  
          super.setFlags(flag, set);
  
          if (flagChangeListener != null) {
              flagChangeListener.onFlagChange(this, flag, set);
          }
  
      }
docs: /* (non-Javadoc)
  @see javax.mail.internet.MimeMessage#setFlags(javax.mail.Flags, boolean)