Author: markt
Date: Wed Aug 29 21:17:00 2012
New Revision: 1378736
URL: http://svn.apache.org/viewvc?rev=1378736&view=rev
Log:
Clean up
- Java 7 <>
- UCDetector
Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java
tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entries.java
tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entry.java
Modified:
tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java?rev=1378736&r1=1378735&r2=1378736&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java
Wed Aug 29 21:17:00 2012
@@ -42,10 +42,11 @@ public class AsyncStockServlet extends H
public static final String LONG_POLL = "LONG-POLL";
public static final String STREAM = "STREAM";
- static ArrayList<Stock> ticks = new ArrayList<Stock>();
- static ConcurrentLinkedQueue<AsyncContext> clients = new
ConcurrentLinkedQueue<AsyncContext>();
- static AtomicInteger clientcount = new AtomicInteger(0);
- static Stockticker ticker = new Stockticker();
+ static final ArrayList<Stock> ticks = new ArrayList<>();
+ static final ConcurrentLinkedQueue<AsyncContext> clients =
+ new ConcurrentLinkedQueue<>();
+ static final AtomicInteger clientcount = new AtomicInteger(0);
+ static final Stockticker ticker = new Stockticker();
public AsyncStockServlet() {
System.out.println("AsyncStockServlet created");
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java?rev=1378736&r1=1378735&r2=1378736&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java
(original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/Stockticker.java Wed
Aug 29 21:17:00 2012
@@ -23,8 +23,8 @@ import java.util.concurrent.atomic.Atomi
public class Stockticker implements Runnable {
public volatile boolean run = true;
- protected AtomicInteger counter = new AtomicInteger(0);
- ArrayList<TickListener> listeners = new ArrayList<TickListener>();
+ protected final AtomicInteger counter = new AtomicInteger(0);
+ final ArrayList<TickListener> listeners = new ArrayList<>();
protected volatile Thread ticker = null;
protected volatile int ticknr = 0;
@@ -100,8 +100,8 @@ public class Stockticker implements Runn
}
public static final class Stock implements Cloneable {
- protected static DecimalFormat df = new DecimalFormat("0.00");
- protected String symbol = "";
+ protected static final DecimalFormat df = new DecimalFormat("0.00");
+ protected final String symbol;
protected double value = 0.0d;
protected double lastchange = 0.0d;
protected int cnt = 0;
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entries.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entries.java?rev=1378736&r1=1378735&r2=1378736&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entries.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entries.java Wed Aug 29
21:17:00 2012
@@ -22,13 +22,13 @@ import javax.servlet.http.HttpServletReq
public class Entries {
- private Hashtable<String, Entry> entries;
+ private final Hashtable<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<String, Entry>(rows);
+ entries = new Hashtable<>(rows);
for (int i = 0; i < rows; i++) {
entries.put(time[i], new Entry(time[i]));
}
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entry.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entry.java?rev=1378736&r1=1378735&r2=1378736&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entry.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/cal/Entry.java Wed Aug 29
21:17:00 2012
@@ -19,7 +19,7 @@ package cal;
public class Entry {
- String hour;
+ final String hour;
String description;
public Entry(String hour) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]