git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/threadlocal-vars-cleaner@128403 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e25e3e88c1
commit
89be62e437
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>threadlocal-vars-cleaner</artifactId>
|
<artifactId>threadlocal-vars-cleaner</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>threadlocal-vars-cleaner</name>
|
<name>threadlocal-vars-cleaner</name>
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
package org.gcube.portal.threadlocalexec;
|
|
||||||
|
|
||||||
import org.apache.catalina.core.StandardThreadExecutor;
|
|
||||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Massimiliano Assante, CNR ISTI
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SmartGearsPortalExecutor extends StandardThreadExecutor {
|
|
||||||
private static final Logger _log = LoggerFactory.getLogger(SmartGearsPortalExecutor.class);
|
|
||||||
public SmartGearsPortalExecutor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void execute(Runnable command, long timeout, TimeUnit unit) {
|
|
||||||
// super.execute(new WrappedRunnable(command), timeout, unit);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(Runnable command) {
|
|
||||||
super.execute(new WrappedRunnable(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WrappedRunnable implements Runnable{
|
|
||||||
|
|
||||||
private Runnable runnable;
|
|
||||||
|
|
||||||
protected WrappedRunnable(Runnable runnable){
|
|
||||||
this.runnable = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
try{
|
|
||||||
this.runnable.run();
|
|
||||||
_log.debug("execution finished on thread "+Thread.currentThread().getName() + " server.RStudioServiceImpl LOGtoRemove");
|
|
||||||
System.out.println("execution finished on thread "+Thread.currentThread().getName()+ " server.RStudioServiceImpl LOGtoRemove");
|
|
||||||
} finally {
|
|
||||||
SecurityTokenProvider.instance.reset();
|
|
||||||
ScopeProvider.instance.reset();
|
|
||||||
AuthorizationProvider.instance.reset();
|
|
||||||
_log.debug("done reset all the thread locals on thread "+Thread.currentThread().getName()+ " server.RStudioServiceImpl LOGtoRemove");
|
|
||||||
System.out.println("done reset all the thread locals on thread "+Thread.currentThread().getName()+ " server.RStudioServiceImpl LOGtoRemove");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portal.threadlocalexec;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
|
||||||
|
import org.apache.catalina.connector.Request;
|
||||||
|
import org.apache.catalina.connector.Response;
|
||||||
|
import org.apache.catalina.valves.ValveBase;
|
||||||
|
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Massimiliano Assante, CNR ISTI
|
||||||
|
* @author Lucio Lelii, CNR ISTI
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SmartGearsPortalValve extends ValveBase {
|
||||||
|
private static final Logger _log = LoggerFactory.getLogger(SmartGearsPortalValve.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(Request req, Response resp) throws IOException, ServletException {
|
||||||
|
SecurityTokenProvider.instance.reset();
|
||||||
|
ScopeProvider.instance.reset();
|
||||||
|
AuthorizationProvider.instance.reset();
|
||||||
|
getNext().invoke(req, resp);
|
||||||
|
_log.trace("SmartGearsPortalValve SecurityTokenProvider and AuthorizationProvider reset OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Tue Apr 19 18:02:51 CEST 2016
|
#Mon May 02 16:49:27 CEST 2016
|
||||||
version=0.0.1-SNAPSHOT
|
version=1.0.0-SNAPSHOT
|
||||||
groupId=org.gcube.portal
|
groupId=org.gcube.portal
|
||||||
artifactId=threadlocal-vars-cleaner
|
artifactId=threadlocal-vars-cleaner
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
<Packages>
|
<Packages>
|
||||||
<Software>
|
<Software>
|
||||||
<Name>threadlocal-vars-cleaner</Name>
|
<Name>threadlocal-vars-cleaner</Name>
|
||||||
<Version>0.0.1-SNAPSHOT</Version>
|
<Version>1.0.0-SNAPSHOT</Version>
|
||||||
<MavenCoordinates>
|
<MavenCoordinates>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>threadlocal-vars-cleaner</artifactId>
|
<artifactId>threadlocal-vars-cleaner</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</MavenCoordinates>
|
</MavenCoordinates>
|
||||||
<Files>
|
<Files>
|
||||||
<File>threadlocal-vars-cleaner-0.0.1-SNAPSHOT.war</File>
|
<File>threadlocal-vars-cleaner-1.0.0-SNAPSHOT.war</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Software>
|
</Software>
|
||||||
</Packages>
|
</Packages>
|
||||||
|
|
|
@ -26,13 +26,13 @@
|
||||||
"/>
|
"/>
|
||||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||||
<property name="os.name" value="Mac OS X"/>
|
<property name="os.name" value="Mac OS X"/>
|
||||||
<property name="classworlds.conf" value="/Users/massi/Documents/workspace/.metadata/.plugins/org.eclipse.m2e.launching/launches/m2conf4754638736136438161.tmp"/>
|
<property name="classworlds.conf" value="/Users/massi/Documents/workspace/.metadata/.plugins/org.eclipse.m2e.launching/launches/m2conf873602198186611261.tmp"/>
|
||||||
<property name="sun.jnu.encoding" value="UTF-8"/>
|
<property name="sun.jnu.encoding" value="UTF-8"/>
|
||||||
<property name="java.library.path" value="/Users/massi/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."/>
|
<property name="java.library.path" value="/Users/massi/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."/>
|
||||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||||
<property name="java.class.version" value="51.0"/>
|
<property name="java.class.version" value="51.0"/>
|
||||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||||
<property name="os.version" value="10.11.3"/>
|
<property name="os.version" value="10.11.4"/>
|
||||||
<property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
|
<property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
|
||||||
<property name="user.home" value="/Users/massi"/>
|
<property name="user.home" value="/Users/massi"/>
|
||||||
<property name="user.timezone" value="Europe/Rome"/>
|
<property name="user.timezone" value="Europe/Rome"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue