merge
This commit is contained in:
commit
3c68eeaaf4
2 changed files with 23 additions and 5 deletions
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import jp.sf.fess.Constants;
|
||||
import jp.sf.fess.crud.util.SAStrutsUtil;
|
||||
|
@ -47,10 +48,13 @@ import org.codelibs.solr.lib.policy.impl.StatusPolicyImpl;
|
|||
import org.seasar.framework.util.StringUtil;
|
||||
import org.seasar.struts.annotation.ActionForm;
|
||||
import org.seasar.struts.annotation.Execute;
|
||||
import org.seasar.struts.util.RequestUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SystemAction implements Serializable {
|
||||
private static final String STARTING_CRAWL_PROCESS = "startingCrawlProcess";
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(SystemAction.class);
|
||||
|
||||
|
@ -81,8 +85,6 @@ public class SystemAction implements Serializable {
|
|||
@Resource
|
||||
protected ScheduledJobService scheduledJobService;
|
||||
|
||||
private boolean executed = false;
|
||||
|
||||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("system");
|
||||
}
|
||||
|
@ -254,7 +256,8 @@ public class SystemAction implements Serializable {
|
|||
scheduledJob.start();
|
||||
}
|
||||
SAStrutsUtil.addSessionMessage("success.start_crawl_process");
|
||||
executed = true;
|
||||
RequestUtil.getRequest().getSession()
|
||||
.setAttribute(STARTING_CRAWL_PROCESS, Boolean.TRUE);
|
||||
} else {
|
||||
SAStrutsUtil
|
||||
.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
|
@ -344,7 +347,15 @@ public class SystemAction implements Serializable {
|
|||
}
|
||||
|
||||
public boolean isCrawlerRunning() {
|
||||
return executed || jobHelper.isCrawlProcessRunning();
|
||||
final HttpSession session = RequestUtil.getRequest().getSession(false);
|
||||
if (session != null) {
|
||||
final Object obj = session.getAttribute(STARTING_CRAWL_PROCESS);
|
||||
if (obj != null) {
|
||||
session.removeAttribute(STARTING_CRAWL_PROCESS);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return jobHelper.isCrawlProcessRunning();
|
||||
}
|
||||
|
||||
public String[] getRunningSessionIds() {
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.codelibs.solr.lib.policy.StatusPolicy;
|
|||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.Option;
|
||||
import org.mobylet.core.launcher.LaunchConfig;
|
||||
import org.mobylet.core.launcher.MobyletLauncher;
|
||||
import org.seasar.framework.container.ExternalContext;
|
||||
import org.seasar.framework.container.S2Container;
|
||||
|
@ -252,7 +253,13 @@ public class Crawler implements Serializable {
|
|||
|
||||
private static int process(final Options options) {
|
||||
// initialize mobylet
|
||||
MobyletLauncher.launch();
|
||||
final LaunchConfig launchConfig = new LaunchConfig();
|
||||
launchConfig.addParameter("mobylet.logger.class",
|
||||
"jp.sf.fess.log.MobyletLoggerImpl");
|
||||
MobyletLauncher.initSingletonContainer();
|
||||
MobyletLauncher.initLogger(launchConfig);
|
||||
MobyletLauncher.initDefaultCharset(launchConfig);
|
||||
MobyletLauncher.initInitializer(launchConfig);
|
||||
|
||||
final Crawler crawler = SingletonS2Container
|
||||
.getComponent(Crawler.class);
|
||||
|
|
Loading…
Add table
Reference in a new issue