SuggestReviewer: Support reloaded config

SuggestReviewer will automatically pickup the reloaded config,
however we want to notify the admin that issued the reload, that
these config values has changed and will be picked up.

Change-Id: I879d40b3c10856598726e46dc455d702e008139f
This commit is contained in:
Gustaf Lundh
2018-04-16 10:54:53 +02:00
parent f24e9fe279
commit 25e608fa6e
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.config;
import com.google.common.collect.ImmutableSet;
import java.util.Collections;
public class GerritConfigListenerHelper {
public static GerritConfigListener acceptIfChanged(ConfigKey... keys) {
return e ->
e.isEntriesUpdated(ImmutableSet.copyOf(keys))
? Collections.singletonList(e.accept(ImmutableSet.copyOf(keys)))
: Collections.emptyList();
}
}