File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public class Server implements ServerMXBean {
48
48
protected boolean useWorkers ;
49
49
protected final WorkerPool workers ;
50
50
protected final CleanupThread cleanup ;
51
+ protected boolean closeSessions ;
51
52
52
53
public Server (ServerConfig config ) throws IOException {
53
54
List <AcceptorThread > acceptors = new ArrayList <>();
@@ -79,6 +80,8 @@ public Server(ServerConfig config) throws IOException {
79
80
80
81
this .cleanup = new CleanupThread (selectors , config .keepAlive );
81
82
83
+ this .closeSessions = config .closeSessions ;
84
+
82
85
this .selectorStats = new SelectorStats ();
83
86
this .queueStats = new QueueStats ();
84
87
}
@@ -142,6 +145,7 @@ public synchronized void reconfigure(ServerConfig config) throws IOException {
142
145
}
143
146
144
147
cleanup .update (this .selectors , config .keepAlive );
148
+ closeSessions = config .closeSessions ;
145
149
}
146
150
147
151
public synchronized void start () {
@@ -175,6 +179,11 @@ public synchronized void stop() {
175
179
}
176
180
177
181
for (SelectorThread selector : selectors ) {
182
+ if (closeSessions ) {
183
+ for (Session session : selector .selector ) {
184
+ session .close ();
185
+ }
186
+ }
178
187
selector .shutdown ();
179
188
}
180
189
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ public class ServerConfig {
35
35
public int keepAlive ;
36
36
public int threadPriority = Thread .NORM_PRIORITY ;
37
37
public SchedulingPolicy schedulingPolicy ;
38
+ public boolean closeSessions ;
38
39
39
40
public ServerConfig () {
40
41
}
@@ -58,6 +59,7 @@ private ServerConfig(ConnectionString conn) {
58
59
this .queueTime = conn .getIntParam ("queueTime" , 0 ) / 1000 ;
59
60
this .threadPriority = conn .getIntParam ("threadPriority" , Thread .NORM_PRIORITY );
60
61
this .schedulingPolicy = SchedulingPolicy .valueOf (conn .getStringParam ("schedulingPolicy" , "OTHER" ));
62
+ this .closeSessions = conn .getBooleanParam ("closeSessions" , false );
61
63
}
62
64
63
65
// Do not use for new servers! Use ConfigParser instead
You can’t perform that action at this time.
0 commit comments