Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@
import org.eclipse.jetty.ee11.servlet.ServletContextHandler;
import org.eclipse.jetty.ee11.servlet.ServletHolder;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.security.SecurityHandler;
import org.eclipse.jetty.server.*;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.slf4j.Logger;
Expand Down Expand Up @@ -473,10 +476,18 @@ public static Server jettyServer(int minThreads, int maxThreads) {
maxThreads = Math.max(minThreads, maxThreads);
// Args reversed: Jetty uses (max,min)
threadPool = new QueuedThreadPool(maxThreads, minThreads);
Server server = new Server(threadPool);
// Server(ThreadPool) alone installs a default 64KB ArrayByteBufferPool; pass ours explicitly.
Server server = new Server(threadPool, (Scheduler)null, newByteBufferPool());
return server;
}

/** ByteBufferPool sized so its maximum pooled buffer capacity is at least
* {@link FusekiSystemConstants#jettyOutputBufferSize}. */
private static ByteBufferPool newByteBufferPool() {
int maxCapacity = FusekiSystemConstants.jettyOutputBufferSize;
return new ArrayByteBufferPool(0, -1, maxCapacity, -1, -1, -1);
}

private static void serverAddConnectors(Server server, int port, boolean loopback) {
HttpConfiguration httpConnectionFactory = JettyLib.httpConfiguration();
HttpConnectionFactory f1 = new HttpConnectionFactory(httpConnectionFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static int getValueInt(String propertyKey, int defaultValue) {
* Setting for HttpConfiguration.setOutputBufferSize (set in
* {@link JettyLib#httpConfiguration}).
*/
public static final int jettyOutputBufferSize = 5 * 1024 * 1024;
public static final int jettyOutputBufferSize = 2 * 1024 * 1024;

/**
* JettyrRequest header size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
import org.apache.jena.sparql.exec.http.GSP;
import org.apache.jena.sparql.exec.http.QueryExecHTTP;
import org.apache.jena.sparql.sse.SSE;
import org.apache.jena.fuseki.main.sys.FusekiSystemConstants;
import org.apache.jena.system.Txn;
import org.apache.jena.update.UpdateExecution;
import org.eclipse.jetty.io.ArrayByteBufferPool;
import org.eclipse.jetty.server.Server;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;

Expand Down Expand Up @@ -85,6 +88,14 @@ public class TestFusekiServerBuild {
} finally { server.stop(); }
}

@Test public void fuseki_build_byte_buffer_pool() {
FusekiServer server = FusekiServer.create().port(0).build();
Server jettyServer = server.getJettyServer();
ArrayByteBufferPool pool = jettyServer.getBean(ArrayByteBufferPool.class);
assertNotNull(pool);
assertTrue(pool.getMaxCapacity() >= FusekiSystemConstants.jettyOutputBufferSize);
}

// The port in "testing/jetty.xml" is 1077

@Test public void fuseki_ext_jetty_xml_1() {
Expand Down