Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BigDataViewer_Server_Extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioinformaticDataCompression
BigDataViewer_Server_Extension
Commits
46f1bb90
Commit
46f1bb90
authored
10 years ago
by
HongKee Moon
Browse files
Options
Downloads
Patches
Plain Diff
Add ThreadPool and ServerConnector configuration for handling high load
parent
f6bed846
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/bdv/server/BigDataServer.java
+15
-2
15 additions, 2 deletions
src/main/java/bdv/server/BigDataServer.java
with
15 additions
and
2 deletions
src/main/java/bdv/server/BigDataServer.java
+
15
−
2
View file @
46f1bb90
...
...
@@ -3,13 +3,15 @@ package bdv.server;
import
java.util.HashMap
;
import
mpicbg.spim.data.SpimDataException
;
import
org.eclipse.jetty.server.Connector
;
import
org.eclipse.jetty.server.Server
;
import
org.eclipse.jetty.server.ServerConnector
;
import
org.eclipse.jetty.server.handler.ContextHandlerCollection
;
import
org.eclipse.jetty.server.handler.HandlerCollection
;
import
org.eclipse.jetty.server.handler.RequestLogHandler
;
import
org.eclipse.jetty.server.handler.StatisticsHandler
;
import
org.eclipse.jetty.util.log.Log
;
import
org.eclipse.jetty.util.thread.QueuedThreadPool
;
public
class
BigDataServer
{
...
...
@@ -26,10 +28,21 @@ public class BigDataServer
final
int
port
=
args
.
length
>
1
?
Integer
.
parseInt
(
args
[
1
]
)
:
8080
;
System
.
setProperty
(
"org.eclipse.jetty.util.log.class"
,
"org.eclipse.jetty.util.log.StdErrLog"
);
final
Server
server
=
new
Server
(
port
);
// Threadpool for multiple connections
final
Server
server
=
new
Server
(
new
QueuedThreadPool
(
1000
,
10
)
);
// ServerConnector configuration
final
ServerConnector
connector
=
new
ServerConnector
(
server
);
connector
.
setHost
(
"localhost"
);
connector
.
setPort
(
port
);
LOG
.
info
(
"Set connectors: "
+
connector
);
server
.
setConnectors
(
new
Connector
[]
{
connector
}
);
final
String
baseURL
=
"http://"
+
server
.
getURI
().
getHost
()
+
":"
+
port
;
LOG
.
info
(
"Server Base URL: "
+
baseURL
);
// Handler initialization
final
StatisticsHandler
statHandler
=
new
StatisticsHandler
();
final
HandlerCollection
handlers
=
new
HandlerCollection
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment