code: public void updateMaxConnections (final int max) {
  
          try {
              Connection conn = taskBalancer.getConnection();
              int update = 0;
              int targetMaxC = connections.peek().getSettingAsInt(OperationalTextKey.MAX_CONNECTIONS);
              if (targetMaxC <= max) {
                  if (targetMaxC > maxConnections) {
                      update = targetMaxC - maxConnections;
                      maxConnections = targetMaxC;
                  }
              } else {
                  if (max >= maxConnections) {
                      update = max - maxConnections;
                      maxConnections = max;
                  }
              }
  
              SettingsMap sm = new SettingsMap();
              sm.add(OperationalTextKey.MAX_CONNECTIONS, String.valueOf(maxConnections));
              conn.update(sm);
              taskBalancer.releaseConnection(conn);
  
              if (update > 0) {
                  addConnections(update);
              } else {
                  for (int i = -1; i >= update; i--) {
                      taskBalancer.getConnection().close();
                  }
              }
  
          } catch (Exception e) {
              // DO Nothing
          }
  
      }
docs: Updates the MaxConnection setting, so that it grows/shrinks the Connectionlist.
  
  @param max The maximum number of concurrent <code>Connections</code> to a target.