-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdatePeoplePerferences.java
More file actions
61 lines (46 loc) · 1.24 KB
/
UpdatePeoplePerferences.java
File metadata and controls
61 lines (46 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.nxdcms.action;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nxdcms.dao.RecommendDao;
import com.nxdcms.dao.impl.RecommendDaoImpl;
public class UpdatePeoplePerferences extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
}
public void init() throws ServletException {
super.init();
MyThread thread = MyThread.getUpdateBy24();
thread.start();
}
}
class MyThread extends Thread {
private RecommendDao rd;
private static class SingletonFactory {
private static MyThread mythread = new MyThread();
}
public static MyThread getUpdateBy24() {
return SingletonFactory.mythread;
}
private MyThread() {
try {
rd = new RecommendDaoImpl();
} catch (Exception e) {
e.printStackTrace();
}
}
public void run() {
while (true) {
rd.SeekandUpdateStudentBy24();
try {
Thread.sleep(60 * 60 * 24 * 1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}