From a6617ad887cb9f2d6b943f3c76c4613c5fd9adea Mon Sep 17 00:00:00 2001 From: reger Date: Thu, 28 Jan 2016 23:14:09 +0100 Subject: [PATCH] expand initRemoteCrawler() to terminate worker threads if called to deactivate remote crawl. On startup we save the resources for remote crawler if disabled. Once started threads are running idle after disable remote crawl. Now threads are terminated to save the resources also while disabeling during runtime. + remove empty class Channels --- .../net/yacy/cora/document/feed/Channels.java | 31 ------------------- source/net/yacy/search/Switchboard.java | 11 ++++++- 2 files changed, 10 insertions(+), 32 deletions(-) delete mode 100644 source/net/yacy/cora/document/feed/Channels.java diff --git a/source/net/yacy/cora/document/feed/Channels.java b/source/net/yacy/cora/document/feed/Channels.java deleted file mode 100644 index d601486f1..000000000 --- a/source/net/yacy/cora/document/feed/Channels.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Channels - * Copyright 2010 by Michael Peter Christen - * First released 10.5.2010 at http://yacy.net - * - * $LastChangedDate$ - * $LastChangedRevision$ - * $LastChangedBy$ - * - * This file is part of YaCy Content Integration - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program in the file lgpl21.txt - * If not, see . - */ - -package net.yacy.cora.document.feed; - -public class Channels { - -} diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java index 429526988..c26e2ecde 100644 --- a/source/net/yacy/search/Switchboard.java +++ b/source/net/yacy/search/Switchboard.java @@ -1486,7 +1486,9 @@ public final class Switchboard extends serverSwitch { /** * Initialisize and perform all settings to enable remote crawls - * (if remote crawl is not in use, save the resources) + * (if remote crawl is not in use, save the resources) If called with + * activate==false worker threads are closed and removed (to free resources) + * * @param activate true=enable, false=disable */ public void initRemoteCrawler(final boolean activate) { @@ -1536,6 +1538,9 @@ public final class Switchboard extends serverSwitch { } rcl.setBusySleep(getConfigLong(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_BUSYSLEEP, 1000)); rcl.setIdleSleep(getConfigLong(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER_IDLESLEEP, 10000)); + } else { // activate==false, terminate and remove threads + terminateThread(SwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOADER, true); + terminateThread(SwitchboardConstants.CRAWLJOB_REMOTE_TRIGGERED_CRAWL, true); } } @@ -3433,6 +3438,10 @@ public final class Switchboard extends serverSwitch { } } + public void initBookmarks(boolean b) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + public class receiptSending implements Runnable { private final Seed initiatorPeer;