Skip to content

Commit b0ca034

Browse files
author
yuit
committed
commit: 优化
1 parent a121a5b commit b0ca034

File tree

3 files changed

+90
-6
lines changed

3 files changed

+90
-6
lines changed

src/main/resources/statics/styles/base-login.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ body {
1212
background-color: #E9ECEF;
1313
height: 8rem;
1414
line-height: 4rem;
15+
border-bottom-right-radius: 20rem;
16+
border-top-left-radius: 20rem;
1517
}
1618

1719
.header-title .name {

src/main/resources/views/base-login.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ <h2 class="header-title">
122122
<i class="now-ui-icons ui-1_send"></i>
123123
</div>
124124
</div>
125-
<input type="text" disabled class="form-control" required name="code" placeholder="验证码">
125+
<input type="text" class="form-control" required name="code" placeholder="验证码">
126126
</div>
127127
</div>
128128
<div class="form-group col-7">
129-
<button type="button" class="btn btn-outline-primary">获取验证码(180)</button>
129+
<button type="button" class="btn btn-outline-primary">获取验证码(180)</button>
130130
</div>
131131
</div>
132132
<div class="form-row">
133133
<div class="form-group col">
134-
<button type="submit" class="btn btn-primary btn-block"> 登 录 </button>
134+
<button type="submit" disabled class="btn btn-primary btn-block"> 登 录 </button>
135135
</div>
136136
</div>
137137
</form>

src/test/java/Main.java

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import org.springframework.boot.autoconfigure.cache.CacheProperties;
22
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
3+
import org.springframework.security.core.parameters.P;
34
import org.springframework.util.AntPathMatcher;
45

6+
import java.io.*;
7+
import java.util.LinkedList;
8+
import java.util.Queue;
9+
510
/**
611
* @author yuit
712
* @create 2018/10/22 17:38
@@ -10,17 +15,94 @@
1015
*/
1116
public class Main {
1217

13-
public static void main(String[] args){
1418

1519

20+
public static void main(String[] args) throws InterruptedException {
21+
Queue<Integer> res = new LinkedList<>();
22+
Producer p = new Producer(res);
23+
Consumer c = new Consumer(res);
24+
25+
Thread pth = new Thread(p);
26+
Thread cth = new Thread(c);
27+
28+
pth.start();
29+
cth.start();
30+
31+
pth.join();
32+
cth.join();
1633

1734
}
1835

36+
1937
}
2038

21-
/**
39+
class Producer implements Runnable {
40+
41+
private Queue<Integer> res;
42+
43+
public Producer(Queue<Integer> res) {
44+
this.res = res;
45+
}
46+
47+
@Override
48+
public void run() {
49+
50+
synchronized (res){
51+
if (res.size()>=5) {
52+
res.notify();
53+
try {
54+
res.wait();
55+
} catch (InterruptedException e) {
56+
e.printStackTrace();
57+
}
58+
}
2259

60+
res.add(1);
61+
res.notify();
62+
try {
63+
Thread.sleep(1*1000);
64+
} catch (InterruptedException e) {
65+
e.printStackTrace();
66+
}
2367

68+
System.out.println("Producer: "+ res);
2469

70+
run();
71+
}
2572

26-
*/
73+
}
74+
}
75+
76+
77+
class Consumer implements Runnable {
78+
private Queue<Integer> res;
79+
80+
public Consumer(Queue<Integer> res) {
81+
this.res = res;
82+
}
83+
84+
@Override
85+
public void run() {
86+
synchronized (res){
87+
if (res.size()==0) {
88+
res.notify();
89+
try {
90+
res.wait();
91+
} catch (InterruptedException e) {
92+
e.printStackTrace();
93+
}
94+
}
95+
res.poll();
96+
res.notify();
97+
try {
98+
Thread.sleep(1*1000);
99+
} catch (InterruptedException e) {
100+
e.printStackTrace();
101+
}
102+
103+
System.out.println("Consumer: "+ res);
104+
105+
run();
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)