add curtain finally for httpclient closing
This commit is contained in:
parent
145a6cb876
commit
55e98ecef2
6 changed files with 36 additions and 28 deletions
12
pom.xml
12
pom.xml
|
@ -39,8 +39,8 @@
|
|||
|
||||
<!-- Main Framework -->
|
||||
<dbflute.version>1.1.0-sp7</dbflute.version>
|
||||
<lastaflute.version>0.6.0-RCW</lastaflute.version>
|
||||
<lasta.taglib.version>0.6.0-RCA</lasta.taglib.version>
|
||||
<lastaflute.version>0.6.1-D-SNAPSHOT</lastaflute.version>
|
||||
<lasta.taglib.version>0.6.0</lasta.taglib.version>
|
||||
<servlet.version>3.1.0</servlet.version>
|
||||
<jsp.version>2.3.1</jsp.version>
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
<!-- Testing -->
|
||||
<junit.version>4.8.2</junit.version>
|
||||
<utflute.version>0.5.0-sp7</utflute.version>
|
||||
<utflute.version>0.5.0-sp8-A-SNAPSHOT</utflute.version>
|
||||
<jetty.boot.version>0.3.2</jetty.boot.version>
|
||||
|
||||
<!-- S2Robot -->
|
||||
|
@ -326,6 +326,12 @@
|
|||
<name>oss.sonatype.org</name>
|
||||
<id>oss.sonatype.org</id>
|
||||
<url>http://oss.sonatype.org/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots> <!-- TODO jflute temporarily for LastaFlute -->
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.codelibs.fess.Constants;
|
|||
import org.codelibs.fess.FessSystemException;
|
||||
import org.codelibs.fess.annotation.Token;
|
||||
import org.codelibs.fess.app.web.base.FessAdminAction;
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.lastaflute.web.Execute;
|
||||
import org.lastaflute.web.callback.ActionRuntime;
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.codelibs.fess.entity.UserInfo;
|
|||
import org.codelibs.fess.exception.LoginException;
|
||||
import org.codelibs.fess.struts.form.AbstractLoginForm;
|
||||
import org.codelibs.fess.util.ActivityUtil;
|
||||
import org.lastaflute.web.LastaWebKey;
|
||||
import org.lastaflute.web.util.LaResponseUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -96,7 +97,7 @@ public abstract class AbstractLoginAction implements Serializable {
|
|||
|
||||
final HttpSession session = invalidateSession(oldSession);
|
||||
|
||||
session.removeAttribute(Globals.MESSAGE_KEY);
|
||||
session.removeAttribute(LastaWebKey.ACTION_INFO_KEY);
|
||||
|
||||
// create user info
|
||||
final UserInfo loginInfo = new UserInfo();
|
||||
|
|
|
@ -20,7 +20,8 @@ import javax.annotation.Resource;
|
|||
import org.codelibs.fess.mylasta.direction.sponsor.FessActionAdjustmentProvider;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessApiFailureHook;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessCookieResourceProvider;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessCurtainBeforeListener;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessCurtainBeforeHook;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessCurtainFinallyHook;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessListedClassificationProvider;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessMailDeliveryDepartmentCreator;
|
||||
import org.codelibs.fess.mylasta.direction.sponsor.FessSecurityResourceProvider;
|
||||
|
@ -70,16 +71,21 @@ public class FessFwAssistantDirector extends CachedFwAssistantDirector {
|
|||
// even if you set true manually and forget to set false back
|
||||
direction.directFrameworkDebug(fessConfig.isFrameworkDebug()); // basically false
|
||||
|
||||
// you can add your own process when your application is booting
|
||||
direction.directCurtainBefore(createBootListener());
|
||||
// you can add your own process when your application is booting or closing
|
||||
direction.directCurtainBefore(createCurtainBeforeHook());
|
||||
direction.directCurtainFinally(createCurtainFinallyHook()); // when destroy
|
||||
|
||||
direction.directSecurity(createSecurityResourceProvider());
|
||||
direction.directTime(createTimeResourceProvider());
|
||||
direction.directMail(createFessMailDeliveryDepartmentCreator().create());
|
||||
}
|
||||
|
||||
protected FessCurtainBeforeListener createBootListener() {
|
||||
return new FessCurtainBeforeListener();
|
||||
protected FessCurtainBeforeHook createCurtainBeforeHook() {
|
||||
return new FessCurtainBeforeHook();
|
||||
}
|
||||
|
||||
protected FessCurtainFinallyHook createCurtainFinallyHook() {
|
||||
return new FessCurtainFinallyHook();
|
||||
}
|
||||
|
||||
protected FessSecurityResourceProvider createSecurityResourceProvider() { // #change_it_first
|
||||
|
|
|
@ -20,15 +20,15 @@ import java.util.TimeZone;
|
|||
import org.dbflute.system.DBFluteSystem;
|
||||
import org.dbflute.system.provider.DfFinalTimeZoneProvider;
|
||||
import org.dbflute.util.DfTypeUtil;
|
||||
import org.lastaflute.core.direction.CurtainBeforeListener;
|
||||
import org.lastaflute.core.direction.CurtainBeforeHook;
|
||||
import org.lastaflute.core.direction.FwAssistantDirector;
|
||||
|
||||
/**
|
||||
* @author jflute
|
||||
*/
|
||||
public class FessCurtainBeforeListener implements CurtainBeforeListener {
|
||||
public class FessCurtainBeforeHook implements CurtainBeforeHook {
|
||||
|
||||
public void listen(FwAssistantDirector assistantDirector) {
|
||||
public void hook(FwAssistantDirector assistantDirector) {
|
||||
processDBFluteSystem();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -13,31 +13,27 @@
|
|||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.servlet;
|
||||
package org.codelibs.fess.mylasta.direction.sponsor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
import org.lastaflute.core.direction.CurtainFinallyHook;
|
||||
import org.lastaflute.core.direction.FwAssistantDirector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Tomcat7ConfigServlet extends HttpServlet {
|
||||
/**
|
||||
* @author jflute
|
||||
*/
|
||||
public class FessCurtainFinallyHook implements CurtainFinallyHook {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Tomcat7ConfigServlet.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(FessCurtainFinallyHook.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Removing HTTP connection manager...");
|
||||
}
|
||||
public void hook(FwAssistantDirector assistantDirector) {
|
||||
shutdownCommonsHttpClient();
|
||||
}
|
||||
|
||||
private void shutdownCommonsHttpClient() {
|
||||
private void shutdownCommonsHttpClient() { // from Tomcat7ConfigServlet (old class)
|
||||
try {
|
||||
final Class<?> clazz = Class.forName("org.apache.commons.httpclient.MultiThreadedHttpConnectionManager");
|
||||
final Method method = clazz.getMethod("shutdownAll", (Class<?>[]) null);
|
Loading…
Add table
Reference in a new issue