public void addMutedMac(final String mac,final Date muteTill){
  if (isMacMuted(mac)) {
    removeMutedMac(mac);
  }
  Timestamp muteTillTs=null;
  if (muteTill != null) {
    muteTillTs=new Timestamp(muteTill.getTime());
  }
  s_logger.fine("Muting mac:" + mac);
  final Connection con=Database.getConnection();
  try {
    final PreparedStatement ps=con.prepareStatement("insert into muted_macs (mac, mute_till) values (?, ?)");
    ps.setString(1,mac);
    ps.setTimestamp(2,muteTillTs);
    ps.execute();
    ps.close();
    con.commit();
  }
 catch (  final SQLException sqle) {
    if (sqle.getErrorCode() == 30000) {
      s_logger.info("Tried to create duplicate muted mac:" + mac + " error:"+ sqle.getMessage());
      return;
    }
    s_logger.log(Level.SEVERE,"Error inserting muted mac:" + mac,sqle);
    throw new IllegalStateException(sqle.getMessage());
  }
 finally {
    DbUtil.closeConnection(con);
  }
}

public void addMutedMac ( final String mac , final Date muteTill ) { if ( isMacMuted ( mac ) ) { removeMutedMac ( mac ) ; } Timestamp muteTillTs = null ; if ( muteTill != null ) { muteTillTs = new Timestamp ( muteTill . getTime ( ) ) ; } s_logger . fine ( "Muting mac:" + mac ) ; final Connection con = Database . getConnection ( ) ; try { final PreparedStatement ps = con . prepareStatement ( "insert into muted_macs (mac, mute_till) values (?, ?)" ) ; ps . setString ( 1 , mac ) ; ps . setTimestamp ( 2 , muteTillTs ) ; ps . execute ( ) ; ps . close ( ) ; con . commit ( ) ; } catch ( final SQLException sqle ) { if ( sqle . getErrorCode ( ) == 30000 ) { s_logger . info ( "Tried to create duplicate muted mac:" + mac + " error:" + sqle . getMessage ( ) ) ; return ; } s_logger . log ( Level . SEVERE , "Error inserting muted mac:" + mac , sqle ) ; throw new IllegalStateException ( sqle . getMessage ( ) ) ; } finally { DbUtil . closeConnection ( con ) ; } }
mute the given mac . if mutetill is not null , the mute will expire when mutetill is reached . < p > if this mac is already muted , this call will update the mute_end .
