Skip to content

Commit

Permalink
Backport 881517586d7b6d26c5589c3459902eb964ce9030
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Jul 12, 2024
1 parent 55bbe06 commit 5d2481a
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
import java.nio.channels.SocketChannel;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.Timer;
Expand Down Expand Up @@ -161,7 +161,7 @@ class ServerImpl {
logger.log (Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME);
logger.log (Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME);
}
events = new LinkedList<Event>();
events = new ArrayList<>();
logger.log (Level.DEBUG, "HttpServer created "+protocol+" "+ addr);
}

Expand Down Expand Up @@ -428,8 +428,7 @@ private void handleEvent (Event r) {
}
}

final LinkedList<HttpConnection> connsToRegister =
new LinkedList<HttpConnection>();
final ArrayList<HttpConnection> connsToRegister = new ArrayList<>();

void reRegister (HttpConnection c) {
/* re-register with selector */
Expand All @@ -454,7 +453,7 @@ public void run() {
synchronized (lolock) {
if (events.size() > 0) {
list = events;
events = new LinkedList<Event>();
events = new ArrayList<>();
}
}

Expand Down Expand Up @@ -985,7 +984,7 @@ void responseCompleted (HttpConnection c) {
*/
class IdleTimeoutTask extends TimerTask {
public void run () {
LinkedList<HttpConnection> toClose = new LinkedList<HttpConnection>();
ArrayList<HttpConnection> toClose = new ArrayList<>();
final long currentTime = System.currentTimeMillis();
synchronized (idleConnections) {
final Iterator<HttpConnection> it = idleConnections.iterator();
Expand Down Expand Up @@ -1026,7 +1025,7 @@ class ReqRspTimeoutTask extends TimerTask {

// runs every TIMER_MILLIS
public void run () {
LinkedList<HttpConnection> toClose = new LinkedList<HttpConnection>();
ArrayList<HttpConnection> toClose = new ArrayList<>();
final long currentTime = System.currentTimeMillis();
synchronized (reqConnections) {
if (MAX_REQ_TIME != -1) {
Expand All @@ -1043,7 +1042,7 @@ public void run () {
}
}
}
toClose = new LinkedList<HttpConnection>();
toClose = new ArrayList<>();
synchronized (rspConnections) {
if (MAX_RSP_TIME != -1) {
for (HttpConnection c : rspConnections) {
Expand Down

0 comments on commit 5d2481a

Please sign in to comment.