|
@@ -1,19 +1,34 @@
|
|
package com.alvin;
|
|
package com.alvin;
|
|
|
|
|
|
|
|
|
|
|
|
+import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
|
|
@SpringBootApplication
|
|
@SpringBootApplication
|
|
public class Application {
|
|
public class Application {
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
public static void main(String[] args) throws Exception {
|
|
- //SpringApplication.run(Application.class);
|
|
|
|
- for (int i = 0; i < 100; i++) {
|
|
|
|
- boolean test = JedisUtil.tryAcquire("test213", 100, 2);
|
|
|
|
- System.out.println("第" + i + "次操作" + (test ? "成功" : "失败"));
|
|
|
|
- Thread.sleep(100);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ SpringApplication.run(Application.class);
|
|
|
|
+ //StopWatch stopWatch = new StopWatch("");
|
|
|
|
+ //for (int i = 0; i < 1000; i++) {
|
|
|
|
+ // boolean test = JedisUtil.tryAcquire("test213", 1000, 1000);
|
|
|
|
+ //System.out.println("第" + i + "次操作" + (test ? "成功" : "失败"));
|
|
|
|
+ //Thread.sleep(100);
|
|
|
|
+ //}
|
|
|
|
+ //long start = System.currentTimeMillis();
|
|
|
|
+ //
|
|
|
|
+ //for (int i = 0; i < 10000; i++) {
|
|
|
|
+ // new Thread(() -> {
|
|
|
|
+ // JedisUtil.tryAcquire("test213", 1000, 1000);
|
|
|
|
+ // longAdder.increment();
|
|
|
|
+ // if (flag && System.currentTimeMillis() - start >= 1000) {
|
|
|
|
+ // flag = false;
|
|
|
|
+ // System.out.println(longAdder.longValue());
|
|
|
|
+ // }
|
|
|
|
+ // }).start();
|
|
|
|
+ //}
|
|
|
|
+ //System.out.println(longAdder.longValue());
|
|
|
|
+ //Thread.sleep(2000);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|