code: @Override
    public synchronized void addTrigger(final Trigger t) throws TriggerLoaderException {
      logger.info("Inserting trigger " + t.toString() + " into db.");
  
      final SQLTransaction<Long> insertAndGetLastID = transOperator -> {
        transOperator.update(ADD_TRIGGER, DateTime.now().getMillis());
        // This commit must be called in order to unlock trigger table and have last insert ID.
        transOperator.getConnection().commit();
        return transOperator.getLastInsertId();
      };
  
      try {
        final long id = this.dbOperator.transaction(insertAndGetLastID);
        t.setTriggerId((int) id);
        updateTrigger(t);
        logger.info("uploaded trigger " + t.getDescription());
      } catch (final SQLException ex) {
        logger.error("Adding Trigger " + t.getTriggerId() + " failed.");
        throw new TriggerLoaderException("trigger id is not properly created.", ex);
      }
    }
docs: TODO: Don't understand why we need synchronized here.