This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 04657ab7f2 Refactor to avoid use of Hashtable. No functional change. 04657ab7f2 is described below commit 04657ab7f215401f5afdefcc9a266862e1e48c87 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Sep 14 19:18:47 2022 +0100 Refactor to avoid use of Hashtable. No functional change. --- webapps/examples/WEB-INF/classes/cal/Entries.java | 7 ++++--- webapps/examples/WEB-INF/classes/cal/TableBean.java | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/webapps/examples/WEB-INF/classes/cal/Entries.java b/webapps/examples/WEB-INF/classes/cal/Entries.java index f34f957a2f..5c6cd49888 100644 --- a/webapps/examples/WEB-INF/classes/cal/Entries.java +++ b/webapps/examples/WEB-INF/classes/cal/Entries.java @@ -16,19 +16,20 @@ */ package cal; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import jakarta.servlet.http.HttpServletRequest; public class Entries { - private final Hashtable<String, Entry> entries; + private final Map<String, Entry> entries; private static final String[] time = { "8am", "9am", "10am", "11am", "12pm", "1pm", "2pm", "3pm", "4pm", "5pm", "6pm", "7pm", "8pm" }; public static final int rows = 12; public Entries() { - entries = new Hashtable<>(rows); + entries = new ConcurrentHashMap<>(rows); for (int i = 0; i < rows; i++) { entries.put(time[i], new Entry(time[i])); } diff --git a/webapps/examples/WEB-INF/classes/cal/TableBean.java b/webapps/examples/WEB-INF/classes/cal/TableBean.java index 6e855e11bf..e7821257cf 100644 --- a/webapps/examples/WEB-INF/classes/cal/TableBean.java +++ b/webapps/examples/WEB-INF/classes/cal/TableBean.java @@ -16,22 +16,23 @@ */ package cal; -import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import jakarta.servlet.http.HttpServletRequest; public class TableBean { - final Hashtable<String, Entries> table; - final JspCalendar JspCal; - Entries entries; - String date; - String name = null; - String email = null; - boolean processError = false; + private final Map<String, Entries> table; + private final JspCalendar JspCal; + private Entries entries; + private String date; + private String name = null; + private String email = null; + private boolean processError = false; public TableBean() { - this.table = new Hashtable<>(10); + this.table = new ConcurrentHashMap<>(10); this.JspCal = new JspCalendar(); this.date = JspCal.getCurrentDate(); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org