xueli.xue hace 10 años
padre
commit
1a40c4cfe4

+ 0 - 58
xxl-job-admin/src/main/java/com/xxl/controller/IndexController.java Ver fichero

@@ -1,10 +1,8 @@
1 1
 package com.xxl.controller;
2 2
 
3
-import java.text.MessageFormat;
4 3
 import java.util.HashMap;
5 4
 import java.util.List;
6 5
 import java.util.Map;
7
-import java.util.concurrent.TimeUnit;
8 6
 
9 7
 import org.apache.commons.lang.StringUtils;
10 8
 import org.quartz.CronExpression;
@@ -138,60 +136,4 @@ public class IndexController {
138 136
 		return "job/help";
139 137
 	}
140 138
 	
141
-	private int simpleParam = 0;
142
-	private ThreadLocal<Integer> tlParam;
143
-	
144
-	@RequestMapping("/beat")
145
-	@ResponseBody
146
-	public String beat() {
147
-		if (tlParam == null) {
148
-			tlParam = new ThreadLocal<Integer>();
149
-		}
150
-		if (tlParam.get() == null) {
151
-			tlParam.set(5000);
152
-		}
153
-		simpleParam++;
154
-		tlParam.set(tlParam.get() + 1);
155
-		
156
-		long start = System.currentTimeMillis();
157
-		try {
158
-			TimeUnit.SECONDS.sleep(1);
159
-		} catch (InterruptedException e) {
160
-			e.printStackTrace();
161
-		}
162
-		long end = System.currentTimeMillis();
163
-		return MessageFormat.format("cost:{0}, hashCode:{1}, simpleParam:{2}, tlParam:{3}", 
164
-				(end - start), this.hashCode(), simpleParam, tlParam.get());
165
-	}
166
-	
167
-	
168
-	public static void main(String[] args) {
169
-		Runnable runa = new Runnable() {
170
-			private int simInt = 0;
171
-			private ThreadLocal<Integer> tlParam = new ThreadLocal<Integer>();
172
-			@Override
173
-			public void run() {
174
-				while (true) {
175
-					try {
176
-						TimeUnit.SECONDS.sleep(1);
177
-					} catch (InterruptedException e) {
178
-						e.printStackTrace();
179
-					}
180
-					
181
-					if (tlParam.get() == null) {
182
-						tlParam.set(0);
183
-					}
184
-					simInt++;
185
-					tlParam.set(tlParam.get()+1);
186
-					System.out.println(Thread.currentThread().hashCode() + ":simInt:" + simInt);
187
-					System.out.println(Thread.currentThread().hashCode() + ":tlParam:" + tlParam.get());
188
-				}
189
-			}
190
-		};
191
-		
192
-		Thread t1 = new Thread(runa);
193
-		Thread t2 = new Thread(runa);
194
-		t1.start();
195
-		t2.start();
196
-	}
197 139
 }