You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/10/06 10:39:35 UTC

[tomcat] branch 10.0.x updated: Refactor to replace LinkedList with ArrayDeque

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
     new 9445163f33 Refactor to replace LinkedList with ArrayDeque
9445163f33 is described below

commit 9445163f336934f1f60674a2b4ca682a57464869
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 6 11:38:53 2022 +0100

    Refactor to replace LinkedList with ArrayDeque
---
 java/org/apache/catalina/ha/session/DeltaRequest.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/ha/session/DeltaRequest.java b/java/org/apache/catalina/ha/session/DeltaRequest.java
index 1d1dd23e44..f5134f5fd5 100644
--- a/java/org/apache/catalina/ha/session/DeltaRequest.java
+++ b/java/org/apache/catalina/ha/session/DeltaRequest.java
@@ -29,7 +29,8 @@ import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.security.Principal;
-import java.util.LinkedList;
+import java.util.ArrayDeque;
+import java.util.Deque;
 
 import org.apache.catalina.SessionListener;
 import org.apache.catalina.realm.GenericPrincipal;
@@ -65,8 +66,8 @@ public class DeltaRequest implements Externalizable {
     public static final String NAME_LISTENER = "__SET__LISTENER__";
 
     private String sessionId;
-    private LinkedList<AttributeInfo> actions = new LinkedList<>();
-    private final LinkedList<AttributeInfo> actionPool = new LinkedList<>();
+    private Deque<AttributeInfo> actions = new ArrayDeque<>();
+    private final Deque<AttributeInfo> actionPool = new ArrayDeque<>();
 
     private boolean recordAllActions = false;
 
@@ -291,7 +292,7 @@ public class DeltaRequest implements Externalizable {
         recordAllActions = in.readBoolean();
         int cnt = in.readInt();
         if (actions == null) {
-            actions = new LinkedList<>();
+            actions = new ArrayDeque<>();
         } else {
             actions.clear();
         }
@@ -322,8 +323,7 @@ public class DeltaRequest implements Externalizable {
         out.writeUTF(getSessionId());
         out.writeBoolean(recordAllActions);
         out.writeInt(getSize());
-        for ( int i=0; i<getSize(); i++ ) {
-            AttributeInfo info = actions.get(i);
+        for (AttributeInfo info : actions) {
             info.writeExternal(out);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org