diff --git a/benchmark/pom.xml b/benchmark/pom.xml
index eed8ba518..e1e326418 100644
--- a/benchmark/pom.xml
+++ b/benchmark/pom.xml
@@ -23,8 +23,8 @@
javax.servlet
- servlet-api
- 2.5
+ javax.servlet-api
+ ${servlet-api.version}
provided
diff --git a/main/pom.xml b/main/pom.xml
index 5732c509c..35a1d92da 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -171,14 +171,14 @@
javax.servlet
- servlet-api
- 2.5
+ javax.servlet-api
+ ${servlet-api.version}
provided
org.openrefine.dependencies
butterfly
- 1.0.4
+ ${butterfly.version}
org.mozilla
@@ -367,6 +367,11 @@
juniversalchardet
2.4.0
+
+ org.eclipse.jetty
+ jetty-servlets
+ ${jetty.version}
+
diff --git a/main/tests/server/src/com/google/refine/importing/ImportingUtilitiesTests.java b/main/tests/server/src/com/google/refine/importing/ImportingUtilitiesTests.java
index 52bdc5221..a456c7454 100644
--- a/main/tests/server/src/com/google/refine/importing/ImportingUtilitiesTests.java
+++ b/main/tests/server/src/com/google/refine/importing/ImportingUtilitiesTests.java
@@ -66,6 +66,7 @@ import com.google.refine.util.JSONUtilities;
import com.google.refine.util.ParsingUtilities;
import com.google.refine.util.TestUtils;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
@@ -167,6 +168,21 @@ public class ImportingUtilitiesTests extends ImporterTest {
return delegate.read();
}
+ @Override
+ public boolean isFinished() {
+ return false;
+ }
+
+ @Override
+ public boolean isReady() {
+ return true;
+ }
+
+ @Override
+ public void setReadListener(ReadListener readListener) {
+
+ }
+
}
/**
diff --git a/main/webapp/WEB-INF/web.xml b/main/webapp/WEB-INF/web.xml
index 409fd4a4e..11c17339c 100644
--- a/main/webapp/WEB-INF/web.xml
+++ b/main/webapp/WEB-INF/web.xml
@@ -1,10 +1,10 @@
-
-
-
-
-
+
+
OpenRefine
OpenRefine Webapp
@@ -22,7 +22,7 @@
GzipFilter
- org.mortbay.servlet.GzipFilter
+ org.eclipse.jetty.servlets.GzipFilter
mimeTypes
text/html,text/plain,text/xml,application/xhtml+xml,text/css,text/javascript,application/javascript,application/json,image/svg+xml
diff --git a/pom.xml b/pom.xml
index 3fcf1745d..bb367ed06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,10 @@
UTF-8
2.12.1
+ 3.1.0
+ 1.1.1
1.7.30
+ 9.4.26.v20200117
diff --git a/refine b/refine
index 7b85b009f..a981f945f 100755
--- a/refine
+++ b/refine
@@ -503,7 +503,7 @@ ui_test() {
add_option "-Drefine.headless=true"
add_option "-Drefine.autoreload=false"
add_option "-Dbutterfly.autoreload=false"
-
+
run fork > /dev/null
echo "Waiting for OpenRefine to load..."
diff --git a/server/pom.xml b/server/pom.xml
index 384eb3994..841101de6 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -154,18 +154,23 @@
javax.servlet
- servlet-api
- 2.5
+ javax.servlet-api
+ ${servlet-api.version}
- org.mortbay.jetty
- jetty
- 6.1.26
+ org.eclipse.jetty
+ jetty-server
+ ${jetty.version}
- org.mortbay.jetty
- jetty-util
- 6.1.26
+ org.eclipse.jetty
+ jetty-servlet
+ ${jetty.version}
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ ${jetty.version}
org.openrefine.dependencies
@@ -175,7 +180,7 @@
org.openrefine.dependencies
butterfly
- 1.0.4
+ ${butterfly.version}
org.mozilla
diff --git a/server/src/com/google/refine/Refine.java b/server/src/com/google/refine/Refine.java
index d57b96ae9..4436934e6 100644
--- a/server/src/com/google/refine/Refine.java
+++ b/server/src/com/google/refine/Refine.java
@@ -51,18 +51,23 @@ import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import org.apache.log4j.Level;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.webapp.WebAppContext;
-import org.mortbay.util.Scanner;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.handler.StatisticsHandler;
+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.LoggerFactory;
import com.codeberry.jdatapath.DataPath;
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
@@ -82,7 +87,7 @@ public class Refine {
// tell jetty to use SLF4J for logging instead of its own stuff
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
System.setProperty("apple.laf.useScreenMenuBar", "true");
@@ -135,6 +140,18 @@ public class Refine {
class RefineServer extends 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 queue = new LinkedBlockingQueue(maxQueue);
+ return new ThreadPoolExecutorAdapter(new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue));
+ }
private ThreadPoolExecutor threadPool;
@@ -146,21 +163,13 @@ class RefineServer extends Server {
logger.info("refine.memory size: " + memory + " JVM Max heap: " + Runtime.getRuntime().maxMemory());
}
- 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 queue = new LinkedBlockingQueue(maxQueue);
-
- threadPool = new ThreadPoolExecutor(maxThreads, maxQueue, keepAliveTime, TimeUnit.SECONDS, queue);
-
- this.setThreadPool(new ThreadPoolExecutorAdapter(threadPool));
-
- Connector connector = new SocketConnector();
+ HttpConfiguration httpConfig = new HttpConfiguration();
+ httpConfig.setSendServerVersion(false);
+ HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
+ ServerConnector connector = new ServerConnector(this, httpFactory);
connector.setPort(port);
connector.setHost(host);
- connector.setMaxIdleTime(Configurations.getInteger("refine.connection.max_idle_time",60000));
- connector.setStatsOn(false);
+ connector.setIdleTimeout(Configurations.getInteger("server.connection.max_idle_time",60000));
this.addConnector(connector);
File webapp = new File(Configurations.get("refine.webapp","main/webapp"));
@@ -185,7 +194,17 @@ class RefineServer extends Server {
this.setHandler(context);
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
if (Configurations.getBoolean("refine.autoreload",false)) {
@@ -210,7 +229,7 @@ class RefineServer extends Server {
if (threadPool != null) {
threadPool.shutdown();
}
-
+ Thread.sleep(3000);
// then let the parent stop
super.doStop();
} 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 found) {
@@ -502,14 +525,6 @@ class ShutdownSignalHandler implements Runnable {
@Override
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 {
_server.stop();
} catch (Exception e) {
diff --git a/server/src/com/google/util/threads/ThreadPoolExecutorAdapter.java b/server/src/com/google/util/threads/ThreadPoolExecutorAdapter.java
index 70e14a262..a7c82073d 100644
--- a/server/src/com/google/util/threads/ThreadPoolExecutorAdapter.java
+++ b/server/src/com/google/util/threads/ThreadPoolExecutorAdapter.java
@@ -19,9 +19,9 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import org.mortbay.component.LifeCycle;
-import org.mortbay.log.Log;
-import org.mortbay.thread.ThreadPool;
+import org.eclipse.jetty.util.component.LifeCycle;
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.thread.ThreadPool;
/**
* Jetty {@link ThreadPool} that bridges requests to a
@@ -36,13 +36,11 @@ public class ThreadPoolExecutorAdapter implements ThreadPool, LifeCycle {
}
@Override
- public boolean dispatch(Runnable job) {
+ public void execute(Runnable job) {
try {
executor.execute(job);
- return true;
} catch (RejectedExecutionException e) {
- Log.warn(e);
- return false;
+ Log.getLog().warn(e);
}
}