rm SvcBackupUtil/ClearGfeOrphanedLocks
This commit is contained in:
parent
2ab8418fda
commit
50ac8032f9
4 changed files with 0 additions and 533 deletions
|
@ -45,7 +45,6 @@ Export-Package: com.raytheon.edex.plugin.gfe,
|
|||
com.raytheon.edex.plugin.gfe.server.database,
|
||||
com.raytheon.edex.plugin.gfe.server.lock,
|
||||
com.raytheon.edex.plugin.gfe.smartinit,
|
||||
com.raytheon.edex.plugin.gfe.svcbackup,
|
||||
com.raytheon.edex.plugin.gfe.textproducts,
|
||||
com.raytheon.edex.plugin.gfe.util
|
||||
Import-Package: com.raytheon.edex.db.dao,
|
||||
|
|
|
@ -87,9 +87,6 @@
|
|||
<bean id="getLatestDbIdHandler" class="com.raytheon.edex.plugin.gfe.server.handler.GetLatestModelDbIdHandler"/>
|
||||
<bean id="getTopoDataHandler" class="com.raytheon.edex.plugin.gfe.server.handler.GetTopoDataHandler"/>
|
||||
<bean id="rsyncGridsToCWFHandler" class="com.raytheon.edex.plugin.gfe.server.handler.RsyncGridsToCWFHandler"/>
|
||||
<bean id="ClearGfeOrphanedLocks" class="com.raytheon.edex.plugin.gfe.server.lock.ClearGfeOrphanedLocks">
|
||||
<property name="provider" ref="brokerRestProvider" />
|
||||
</bean>
|
||||
|
||||
<!-- ISC Send Beans -->
|
||||
|
||||
|
@ -150,72 +147,8 @@
|
|||
<endpoint id="gfeLogPurgeCron" uri="clusteredquartz://gfe/purgeGfeLogs/?cron=${purge.gfe.logs.cron}"/>
|
||||
<endpoint id="gfeProductIscPurgeCron" uri="clusteredquartz://gfe/purgeGfeProductsIsc/?cron=${purge.gfe.products.isc.cron}"/>
|
||||
<endpoint id="gfeProductAtblPurgeCron" uri="clusteredquartz://gfe/purgeGfeProductsAtbl/?cron=${purge.gfe.products.atbl.cron}"/>
|
||||
<endpoint id="gfeClearOrphanedLocksCron" uri="clusteredquartz://gfe/clearGfeOrhpanedLocks/?cron=${clear.gfe.orphaned.locks.cron}"/>
|
||||
<endpoint id="iscDataRecEndpoint" uri="jms-durable:queue:gfeIscDataReceive?concurrentConsumers=${iscDataRec.threads}"/>
|
||||
|
||||
<route id="purgeGfeLogs">
|
||||
<from uri="gfeLogPurgeCron"/>
|
||||
<to uri="jms-generic:queue:purgeGfeLogWork"/>
|
||||
</route>
|
||||
<route id="purgeGfeLogWork">
|
||||
<from uri="jms-generic:queue:purgeGfeLogWork"/>
|
||||
<doTry>
|
||||
<bean ref="logPurger" method="purge"/>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:svcBackup?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<route id="purgeGfeProductsIsc">
|
||||
<from uri="gfeProductIscPurgeCron"/>
|
||||
<to uri="jms-generic:queue:purgeGfeProductIscWork"/>
|
||||
</route>
|
||||
<route id="purgeGfeProductIscWork">
|
||||
<from uri="jms-generic:queue:purgeGfeProductIscWork"/>
|
||||
<doTry>
|
||||
<bean ref="productIscPurger" method="purge"/>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:svcBackup?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<route id="purgeGfeProductsAtbl">
|
||||
<from uri="gfeProductAtblPurgeCron"/>
|
||||
<to uri="jms-generic:queue:purgeGfeProductAtblWork"/>
|
||||
</route>
|
||||
<route id="purgeGfeProductAtblWork">
|
||||
<from uri="jms-generic:queue:purgeGfeProductAtblWork"/>
|
||||
<doTry>
|
||||
<bean ref="productAtblPurger" method="purge"/>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:svcBackup?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<route id="clearGfeOrphanedLocks">
|
||||
<from uri="gfeClearOrphanedLocksCron"/>
|
||||
<to uri="jms-generic:queue:clearOrphanedLocksWork"/>
|
||||
</route>
|
||||
<route id="clearOrphanedLocksWork">
|
||||
<from uri="jms-generic:queue:clearOrphanedLocksWork"/>
|
||||
<doTry>
|
||||
<bean ref="ClearGfeOrphanedLocks" method="clearLocksCron"/>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:svcBackup?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
|
||||
<!-- ISC Data Receive route -->
|
||||
<route id="iscReceiveRoute">
|
||||
<from ref="iscDataRecEndpoint" />
|
||||
|
|
|
@ -1,155 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.edex.plugin.gfe.server.lock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.edex.plugin.gfe.server.IFPServer;
|
||||
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.lock.Lock;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable.LockMode;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GfeNotification;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.notify.LockNotification;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.server.request.LockRequest;
|
||||
import com.raytheon.uf.common.message.WsId;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.esb.camel.jms.IBrokerRestProvider;
|
||||
|
||||
/**
|
||||
* GFE task to clear orphaned locks from the database table. Orphaned locks are
|
||||
* locks whose session ID is not in the list of current Qpid sessions.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- --------------- --------------------------------------
|
||||
* Mar 03, 2015 629 mgamazaychikov Initial creation
|
||||
* Jan 25, 2017 6092 randerso Renamed interface to
|
||||
* IBrokerRestProvider
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mgamazaychikov
|
||||
*/
|
||||
|
||||
public class ClearGfeOrphanedLocks {
|
||||
private static IBrokerRestProvider provider;
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ClearGfeOrphanedLocks.class);
|
||||
|
||||
public static void setProvider(IBrokerRestProvider provider) {
|
||||
ClearGfeOrphanedLocks.provider = provider;
|
||||
}
|
||||
|
||||
private void breakLocks(Set<String> clients, List<Lock> lockList,
|
||||
LockManager lockMgr, String siteId) {
|
||||
boolean foundOrpanedLocks = false;
|
||||
List<LockRequest> lreq = new ArrayList<>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Lock lock : lockList) {
|
||||
String lockWsid = lock.getWsId().toString();
|
||||
if (!clients.contains(lockWsid)) {
|
||||
foundOrpanedLocks = true;
|
||||
List<Lock> lst = new ArrayList<>();
|
||||
lst.add(lock);
|
||||
// Inactive clients found
|
||||
lreq.add(new LockRequest(lock.getParmId(), lock.getTimeRange(),
|
||||
LockMode.BREAK_LOCK));
|
||||
sb.append(" Breaking orphaned lock for site " + siteId + " on "
|
||||
+ lock.getParmId().toString() + " owned by "
|
||||
+ lock.getWsId().toPrettyString() + ".");
|
||||
|
||||
}
|
||||
}
|
||||
if (foundOrpanedLocks) {
|
||||
statusHandler.info(sb.toString());
|
||||
WsId requestor = new WsId(null, null, "ClearGfeOrphanedLocks");
|
||||
ServerResponse<List<LockTable>> sr = lockMgr.requestLockChange(lreq,
|
||||
requestor);
|
||||
if (sr.isOkay()) {
|
||||
try {
|
||||
List<LockTable> lockTables = sr.getPayload();
|
||||
List<GfeNotification> notes = new ArrayList<>(
|
||||
lockTables.size());
|
||||
|
||||
for (LockTable table : lockTables) {
|
||||
notes.add(new LockNotification(table, siteId));
|
||||
}
|
||||
ServerResponse<?> notifyResponse = SendNotifications
|
||||
.send(notes);
|
||||
if (!notifyResponse.isOkay()) {
|
||||
statusHandler.error(notifyResponse.message());
|
||||
}
|
||||
|
||||
// send out grid update notifications
|
||||
notifyResponse = SendNotifications
|
||||
.send(sr.getNotifications());
|
||||
if (!notifyResponse.isOkay()) {
|
||||
statusHandler.error(notifyResponse.message());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error sending lock notification", e);
|
||||
}
|
||||
} else {
|
||||
statusHandler.error(sr.message());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
statusHandler
|
||||
.info(" No orphaned locks found for site " + siteId + ".");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLocksCron() throws Exception {
|
||||
statusHandler
|
||||
.info("Started at " + new Date(System.currentTimeMillis()));
|
||||
if (IFPServer.getActiveServers().size() == 0) {
|
||||
statusHandler.info("No active IFPServer found.");
|
||||
return;
|
||||
}
|
||||
|
||||
Set<String> clients = new HashSet<>(provider.getConnections());
|
||||
for (IFPServer ifps : IFPServer.getActiveServers()) {
|
||||
LockManager lockMgr = ifps.getLockMgr();
|
||||
String siteId = ifps.getSiteId();
|
||||
try {
|
||||
List<Lock> lockList = lockMgr.getAllLocks(siteId);
|
||||
|
||||
// find orphaned locks and break them
|
||||
breakLocks(clients, lockList, lockMgr, siteId);
|
||||
} catch (GfeException e) {
|
||||
statusHandler.error("Error retrieving all locks", e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,310 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
|
||||
package com.raytheon.edex.plugin.gfe.svcbackup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.LocalizationUtil;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
import com.raytheon.uf.common.util.RunProcess;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.site.SiteAwareRegistry;
|
||||
|
||||
/**
|
||||
*
|
||||
* Utility class for Service Backup
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ------------ -----------------------------------------
|
||||
* Oct 09, 2009 bphillip Initial creation
|
||||
* Sep 19, 2011 10955 rferrel make sure process destroy is called.
|
||||
* Jun 12, 2012 609 djohnson Use EDEXUtil for EDEX_HOME.
|
||||
* Nov 15, 2012 15614 jdynina Added check for national center
|
||||
* May 02, 2013 1762 dgilling Remove check for national center, add
|
||||
* method to retrieve list of svcbu sites.
|
||||
* May 28, 2014 3211 njensen Use IAuthorizer instead of IRoleStorage
|
||||
* Jul 10, 2014 2914 garmendariz Remove EnvProperties
|
||||
* Feb 17, 2015 4103 dgilling Add getLockDir for specific site, code
|
||||
* cleanup.
|
||||
* Mar 27, 2015 4103 dgilling Support new location for
|
||||
* svcbu.properties.
|
||||
* Dec 15, 2015 5166 kbisanz Update logging to use SLF4J
|
||||
* Jul 15, 2016 5747 dgilling Move edex_static to common_static.
|
||||
* Oct 24, 2016 5951 dgilling Cleanup logging in executeProcess.
|
||||
* May 23, 2017 6285 randerso Removed authorizeWithLocalization.
|
||||
* Code cleanup.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
*/
|
||||
public class SvcBackupUtil {
|
||||
|
||||
private static final String SVCBU_PROPS_PATH = LocalizationUtil.join("gfe",
|
||||
"config", "svcbu.properties");
|
||||
|
||||
/** The logger instance */
|
||||
protected static transient Logger logger = LoggerFactory
|
||||
.getLogger(SvcBackupUtil.class);
|
||||
|
||||
/**
|
||||
* A private constructor so that Java does not attempt to create one for us.
|
||||
* As this class should not be instantiated, do not attempt to ever call
|
||||
* this constructor; it will simply throw an AssertionError.
|
||||
*
|
||||
*/
|
||||
private SvcBackupUtil() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute command defined by args
|
||||
*
|
||||
* @param args
|
||||
* command arguments
|
||||
* @return The output of the process
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String execute(String... args) throws Exception {
|
||||
String[] newArgs = new String[args.length + 1];
|
||||
newArgs[0] = "sh";
|
||||
System.arraycopy(args, 0, newArgs, 1, newArgs.length - 1);
|
||||
return executeProcess(newArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a process using the java.lang.ProcessBuilder.
|
||||
* <p>
|
||||
* The first argument is the command to execute. The proceeding arguments
|
||||
* are the arguments to pass to the command for execution
|
||||
*
|
||||
* @param args
|
||||
* First argument is the command. The proceeding arguments are
|
||||
* the arguments to pass to the command for execution
|
||||
* @return The output of the process
|
||||
* @throws GfeException
|
||||
* If errors occur while executing the process
|
||||
*/
|
||||
private static String executeProcess(String... args) throws GfeException {
|
||||
RunProcess proc = RunProcess.getRunProcess();
|
||||
ProcessBuilder pBuilder = new ProcessBuilder();
|
||||
pBuilder.environment().put("LOCALIZATION_PATH",
|
||||
EDEXUtil.getEdexUtility());
|
||||
pBuilder.environment().put("AWIPS_HOME", "/awips2/");
|
||||
pBuilder.redirectErrorStream(true);
|
||||
pBuilder.command(args);
|
||||
try {
|
||||
proc.setProcess(pBuilder.start());
|
||||
} catch (IOException e) {
|
||||
throw new GfeException("Error executing process", e);
|
||||
}
|
||||
|
||||
int exitValue = 0;
|
||||
String processOutput = "";
|
||||
|
||||
exitValue = proc.waitFor();
|
||||
if (proc.isProcessInterrupted()) {
|
||||
throw new GfeException("Process interrupted");
|
||||
}
|
||||
processOutput = proc.getStdout();
|
||||
if (exitValue != 0) {
|
||||
if (StringUtils.isNotBlank(processOutput)) {
|
||||
String msg = String.format(
|
||||
"Command [%s] terminated abnormally: \n%s",
|
||||
StringUtils.join(args, ' '), processOutput);
|
||||
logger.error(msg);
|
||||
}
|
||||
throw new GfeException("Process terminated abnormally");
|
||||
}
|
||||
return processOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* Examines the InputStream of a process and extracts any output into a
|
||||
* String
|
||||
*
|
||||
* @param p
|
||||
* The process to get the output from
|
||||
* @return The output
|
||||
* @throws GfeException
|
||||
* If problems occur reading the process output
|
||||
*/
|
||||
public static String getProcessOutput(Process p) throws GfeException {
|
||||
|
||||
String retVal = null;
|
||||
InputStream in = p.getInputStream();
|
||||
StringBuilder out = new StringBuilder();
|
||||
int read = 0;
|
||||
final byte[] buffer = new byte[0x10000];
|
||||
try {
|
||||
do {
|
||||
read = in.read(buffer, 0, buffer.length);
|
||||
if (read > 0) {
|
||||
out.append(new String(buffer), 0, read);
|
||||
}
|
||||
} while (read >= 0);
|
||||
} catch (IOException e) {
|
||||
throw new GfeException("Error reading process output", e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to close process input stream!", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
p.getOutputStream().close();
|
||||
} catch (IOException e1) {
|
||||
logger.error("Unable to close process output stream!", e1);
|
||||
}
|
||||
|
||||
try {
|
||||
p.getErrorStream().close();
|
||||
} catch (IOException e1) {
|
||||
logger.error("Unable to close process error stream!", e1);
|
||||
}
|
||||
}
|
||||
|
||||
retVal = out.toString();
|
||||
if (retVal.endsWith("\n")) {
|
||||
retVal = retVal.substring(0, retVal.length() - 1);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contents of svcbu.properties
|
||||
*
|
||||
* @return the svcbu properties
|
||||
*/
|
||||
public static Properties getSvcBackupProperties() {
|
||||
Properties svcbuProperties = new Properties();
|
||||
|
||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationFile basePropsFile = pathMgr.getLocalizationFile(
|
||||
pathMgr.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.BASE),
|
||||
SVCBU_PROPS_PATH);
|
||||
try (InputStream input = basePropsFile.openInputStream()) {
|
||||
svcbuProperties.load(input);
|
||||
} catch (IOException | LocalizationException e) {
|
||||
logger.error("Unable to load BASE level svcbu.properties file.", e);
|
||||
}
|
||||
|
||||
LocalizationFile sitePropsFile = pathMgr.getLocalizationFile(
|
||||
pathMgr.getContextForSite(LocalizationType.COMMON_STATIC,
|
||||
EDEXUtil.getEdexSite()),
|
||||
SVCBU_PROPS_PATH);
|
||||
if (sitePropsFile.exists()) {
|
||||
try (InputStream input = sitePropsFile.openInputStream()) {
|
||||
svcbuProperties.load(input);
|
||||
} catch (IOException | LocalizationException e) {
|
||||
logger.error("Unable to load SITE level svcbu.properties file.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
return svcbuProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base lock directory for service backup. All site specific
|
||||
* lock directories will be children to this directory.
|
||||
*
|
||||
* @return The {@code Path} that represents the base directory for service
|
||||
* backup locks.
|
||||
*/
|
||||
public static Path getLockDir() {
|
||||
String lockDir = SvcBackupUtil.getSvcBackupProperties()
|
||||
.getProperty("LOCK_DIR");
|
||||
return Paths.get(lockDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the site-specific lock directory for service backup.
|
||||
*
|
||||
* @param siteID
|
||||
* The 3-character site identifier.
|
||||
* @return he {@code Path} that represents the site-specific directory for
|
||||
* service backup locks.
|
||||
*/
|
||||
public static Path getLockDir(final String siteID) {
|
||||
return getLockDir().resolve(siteID.toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the set of primary sites
|
||||
*
|
||||
* @return the primary sites
|
||||
*/
|
||||
public static Set<String> getPrimarySites() {
|
||||
Properties svcbuProps = SvcBackupUtil.getSvcBackupProperties();
|
||||
String siteList = EDEXUtil.getEdexSite();
|
||||
if (svcbuProps != null) {
|
||||
String propVal = svcbuProps.getProperty("PRIMARY_SITES", "").trim();
|
||||
if (!propVal.isEmpty()) {
|
||||
siteList = propVal;
|
||||
}
|
||||
}
|
||||
|
||||
String[] sites = siteList.split(",");
|
||||
Set<String> retVal = new HashSet<>(sites.length, 1.0f);
|
||||
Set<String> validSites = Sets
|
||||
.newHashSet(SiteAwareRegistry.getInstance().getActiveSites());
|
||||
for (String site : sites) {
|
||||
String siteId = site.trim().toUpperCase();
|
||||
if (!siteId.isEmpty()) {
|
||||
if (validSites.contains(siteId)) {
|
||||
retVal.add(siteId);
|
||||
} else {
|
||||
final String msg = "Service backup primary site " + site
|
||||
+ " is not a currently activated site. Service backup and export grids tasks cannot be run for this site. Check the PRIMARY_SITES setting in svcbu.properties.";
|
||||
logger.warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue