Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.solr.cloud;
import static org.apache.solr.cloud.api.collections.CollectionHandlingUtils.addExceptionToNamedList;
import static org.apache.solr.common.params.CommonParams.NAME;
import java.lang.invoke.MethodHandles;
import java.util.HashSet;
import java.util.Set;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ConfigSetParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.CoreContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** A {@link OverseerMessageHandler} that handles ConfigSets API related overseer messages. */
public class OverseerConfigSetMessageHandler implements OverseerMessageHandler {
/** Prefix to specify an action should be handled by this handler. */
public static final String CONFIGSETS_ACTION_PREFIX = "configsets:";
private ZkStateReader zkStateReader;
private CoreContainer coreContainer;
// we essentially implement a read/write lock for the ConfigSet exclusivity as follows:
// WRITE: CREATE/DELETE on the ConfigSet under operation
// READ: for the Base ConfigSet being copied in CREATE.
// in this way, we prevent a Base ConfigSet from being deleted while it is being copied
// but don't prevent different ConfigSets from being created with the same Base ConfigSet
// at the same time.
private final Set configSetWriteWip;
private final Set configSetReadWip;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public OverseerConfigSetMessageHandler(ZkStateReader zkStateReader, CoreContainer coreContainer) {
this.zkStateReader = zkStateReader;
this.coreContainer = coreContainer;
this.configSetWriteWip = new HashSet<>();
this.configSetReadWip = new HashSet<>();
}
@Override
public OverseerSolrResponse processMessage(ZkNodeProps message, String operation) {
NamedList