build(deps): bump butterfly from 1.0.4 to 1.1.1 (#3699)

* build(deps): bump butterfly from 1.0.4 to 1.1.0

Bumps [butterfly](https://github.com/OpenRefine/simile-butterfly) from 1.0.4 to 1.1.0.
- [Release notes](https://github.com/OpenRefine/simile-butterfly/releases)
- [Commits](https://github.com/OpenRefine/simile-butterfly/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* Update Butterfly configuration after Jetty upgrade

* Fix main class name in web.xml

* Upgrade Butterfly to Jetty 9

* Temporary debugging output to understand why RefineServlet is not found

* Upgrade servlet-api

* Fix javax.servlet-api artifactId

* Reinstate debug logging temporarily

* Update butterfly to 1.1.1 to solve servlet-api version conflict

* Update javax.servlet-api in the rest of the code base

* Silence server logs in ./refine ui_test again

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
dependabot[bot] 2021-03-18 10:12:57 +01:00 committed by GitHub
parent 9e7a30b6e2
commit 0f024d833e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 62 deletions

View File

@ -23,8 +23,8 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>2.5</version> <version>${servlet-api.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -171,14 +171,14 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>2.5</version> <version>${servlet-api.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openrefine.dependencies</groupId> <groupId>org.openrefine.dependencies</groupId>
<artifactId>butterfly</artifactId> <artifactId>butterfly</artifactId>
<version>1.0.4</version> <version>${butterfly.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mozilla</groupId> <groupId>org.mozilla</groupId>
@ -367,6 +367,11 @@
<artifactId>juniversalchardet</artifactId> <artifactId>juniversalchardet</artifactId>
<version>2.4.0</version> <version>2.4.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
</dependency>
<!-- test dependencies --> <!-- test dependencies -->

View File

@ -66,6 +66,7 @@ import com.google.refine.util.JSONUtilities;
import com.google.refine.util.ParsingUtilities; import com.google.refine.util.ParsingUtilities;
import com.google.refine.util.TestUtils; import com.google.refine.util.TestUtils;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream; import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -167,6 +168,21 @@ public class ImportingUtilitiesTests extends ImporterTest {
return delegate.read(); return delegate.read();
} }
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
} }
/** /**

View File

@ -1,10 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app
<!DOCTYPE web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
metadata-complete="false"
<web-app> version="3.1">
<display-name>OpenRefine</display-name> <display-name>OpenRefine</display-name>
<description>OpenRefine Webapp</description> <description>OpenRefine Webapp</description>
@ -22,7 +22,7 @@
<filter> <filter>
<filter-name>GzipFilter</filter-name> <filter-name>GzipFilter</filter-name>
<filter-class>org.mortbay.servlet.GzipFilter</filter-class> <filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param> <init-param>
<param-name>mimeTypes</param-name> <param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,text/javascript,application/javascript,application/json,image/svg+xml</param-value> <param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,text/javascript,application/javascript,application/json,image/svg+xml</param-value>

View File

@ -61,7 +61,10 @@
<surefireArgs/> <surefireArgs/>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.12.1</jackson.version> <jackson.version>2.12.1</jackson.version>
<servlet-api.version>3.1.0</servlet-api.version>
<butterfly.version>1.1.1</butterfly.version>
<slf4j.version>1.7.30</slf4j.version> <slf4j.version>1.7.30</slf4j.version>
<jetty.version>9.4.26.v20200117</jetty.version>
</properties> </properties>

2
refine
View File

@ -503,7 +503,7 @@ ui_test() {
add_option "-Drefine.headless=true" add_option "-Drefine.headless=true"
add_option "-Drefine.autoreload=false" add_option "-Drefine.autoreload=false"
add_option "-Dbutterfly.autoreload=false" add_option "-Dbutterfly.autoreload=false"
run fork > /dev/null run fork > /dev/null
echo "Waiting for OpenRefine to load..." echo "Waiting for OpenRefine to load..."

View File

@ -154,18 +154,23 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>2.5</version> <version>${servlet-api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty</artifactId> <artifactId>jetty-server</artifactId>
<version>6.1.26</version> <version>${jetty.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId> <artifactId>jetty-servlet</artifactId>
<version>6.1.26</version> <version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.openrefine.dependencies</groupId> <groupId>org.openrefine.dependencies</groupId>
@ -175,7 +180,7 @@
<dependency> <dependency>
<groupId>org.openrefine.dependencies</groupId> <groupId>org.openrefine.dependencies</groupId>
<artifactId>butterfly</artifactId> <artifactId>butterfly</artifactId>
<version>1.0.4</version> <version>${butterfly.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mozilla</groupId> <groupId>org.mozilla</groupId>

View File

@ -51,18 +51,23 @@ import java.util.concurrent.TimeUnit;
import javax.swing.JFrame; import javax.swing.JFrame;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.mortbay.jetty.Connector; import org.eclipse.jetty.server.HttpConfiguration;
import org.mortbay.jetty.Server; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.mortbay.jetty.bio.SocketConnector; import org.eclipse.jetty.server.Server;
import org.mortbay.jetty.servlet.ServletHolder; import org.eclipse.jetty.server.ServerConnector;
import org.mortbay.jetty.webapp.WebAppContext; import org.eclipse.jetty.server.handler.StatisticsHandler;
import org.mortbay.util.Scanner; import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.thread.ThreadPool;
import com.google.util.threads.ThreadPoolExecutorAdapter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.codeberry.jdatapath.DataPath; import com.codeberry.jdatapath.DataPath;
import com.codeberry.jdatapath.JDataPathSystem; import com.codeberry.jdatapath.JDataPathSystem;
import com.google.util.threads.ThreadPoolExecutorAdapter;
import com.google.refine.Configurations;
/** /**
* Main class for Refine server application. Starts an instance of the * Main class for Refine server application. Starts an instance of the
@ -82,7 +87,7 @@ public class Refine {
// tell jetty to use SLF4J for logging instead of its own stuff // tell jetty to use SLF4J for logging instead of its own stuff
System.setProperty("VERBOSE","false"); System.setProperty("VERBOSE","false");
System.setProperty("org.mortbay.log.class","org.mortbay.log.Slf4jLog"); System.setProperty("org.eclipse.jetty.log.class","org.eclipse.jetty.util.log.Slf4jLog");
// tell macosx to keep the menu associated with the screen and what the app title is // tell macosx to keep the menu associated with the screen and what the app title is
System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("apple.laf.useScreenMenuBar", "true");
@ -135,6 +140,18 @@ public class Refine {
class RefineServer extends Server { class RefineServer extends Server {
final static Logger logger = LoggerFactory.getLogger("refine_server"); final static Logger logger = LoggerFactory.getLogger("refine_server");
public RefineServer() {
super(createThreadPool());
}
private static ThreadPool createThreadPool() {
int maxThreads = Configurations.getInteger("refine.queue.size", 30);
int maxQueue = Configurations.getInteger("refine.queue.max_size", 300);
long keepAliveTime = Configurations.getInteger("refine.queue.idle_time", 60);
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueue);
return new ThreadPoolExecutorAdapter(new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue));
}
private ThreadPoolExecutor threadPool; private ThreadPoolExecutor threadPool;
@ -146,21 +163,13 @@ class RefineServer extends Server {
logger.info("refine.memory size: " + memory + " JVM Max heap: " + Runtime.getRuntime().maxMemory()); logger.info("refine.memory size: " + memory + " JVM Max heap: " + Runtime.getRuntime().maxMemory());
} }
int maxThreads = Configurations.getInteger("refine.queue.size", 30); HttpConfiguration httpConfig = new HttpConfiguration();
int maxQueue = Configurations.getInteger("refine.queue.max_size", 300); httpConfig.setSendServerVersion(false);
long keepAliveTime = Configurations.getInteger("refine.queue.idle_time", 60); HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
ServerConnector connector = new ServerConnector(this, httpFactory);
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(maxQueue);
threadPool = new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue);
this.setThreadPool(new ThreadPoolExecutorAdapter(threadPool));
Connector connector = new SocketConnector();
connector.setPort(port); connector.setPort(port);
connector.setHost(host); connector.setHost(host);
connector.setMaxIdleTime(Configurations.getInteger("refine.connection.max_idle_time",60000)); connector.setIdleTimeout(Configurations.getInteger("server.connection.max_idle_time",60000));
connector.setStatsOn(false);
this.addConnector(connector); this.addConnector(connector);
File webapp = new File(Configurations.get("refine.webapp","main/webapp")); File webapp = new File(Configurations.get("refine.webapp","main/webapp"));
@ -185,7 +194,17 @@ class RefineServer extends Server {
this.setHandler(context); this.setHandler(context);
this.setStopAtShutdown(true); this.setStopAtShutdown(true);
this.setSendServerVersion(true); StatisticsHandler handler = new StatisticsHandler();
handler.setServer(this);
handler.setHandler(this.getHandler());
this.addBean(handler);
// Tell the server we want to try and shutdown gracefully
// this means that the server will stop accepting new connections
// right away but it will continue to process the ones that
// are in execution for the given timeout before attempting to stop
// NOTE: this is *not* a blocking method, it just sets a parameter
// that _server.stop() will rely on
this.setStopTimeout(30000);
// Enable context autoreloading // Enable context autoreloading
if (Configurations.getBoolean("refine.autoreload",false)) { if (Configurations.getBoolean("refine.autoreload",false)) {
@ -210,7 +229,7 @@ class RefineServer extends Server {
if (threadPool != null) { if (threadPool != null) {
threadPool.shutdown(); threadPool.shutdown();
} }
Thread.sleep(3000);
// then let the parent stop // then let the parent stop
super.doStop(); super.doStop();
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -260,7 +279,11 @@ class RefineServer extends Server {
} }
}); });
scanner.start(); try {
scanner.start();
} catch (Exception e) {
e.printStackTrace();
}
} }
static private void findFiles(final String extension, File baseDir, final Collection<File> found) { static private void findFiles(final String extension, File baseDir, final Collection<File> found) {
@ -502,14 +525,6 @@ class ShutdownSignalHandler implements Runnable {
@Override @Override
public void run() { public void run() {
// Tell the server we want to try and shutdown gracefully
// this means that the server will stop accepting new connections
// right away but it will continue to process the ones that
// are in execution for the given timeout before attempting to stop
// NOTE: this is *not* a blocking method, it just sets a parameter
// that _server.stop() will rely on
_server.setGracefulShutdown(3000);
try { try {
_server.stop(); _server.stop();
} catch (Exception e) { } catch (Exception e) {

View File

@ -19,9 +19,9 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.mortbay.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
import org.mortbay.log.Log; import org.eclipse.jetty.util.log.Log;
import org.mortbay.thread.ThreadPool; import org.eclipse.jetty.util.thread.ThreadPool;
/** /**
* Jetty {@link ThreadPool} that bridges requests to a * Jetty {@link ThreadPool} that bridges requests to a
@ -36,13 +36,11 @@ public class ThreadPoolExecutorAdapter implements ThreadPool, LifeCycle {
} }
@Override @Override
public boolean dispatch(Runnable job) { public void execute(Runnable job) {
try { try {
executor.execute(job); executor.execute(job);
return true;
} catch (RejectedExecutionException e) { } catch (RejectedExecutionException e) {
Log.warn(e); Log.getLog().warn(e);
return false;
} }
} }