27
27
import org .codelibs .core .log .Logger ;
28
28
29
29
/**
30
- * Timerを扱うクラスです。
30
+ * A class that handles timers.
31
31
*
32
32
* @author higa
33
33
*
@@ -37,34 +37,34 @@ public class TimeoutManager implements Runnable {
37
37
private static final Logger logger = Logger .getLogger (TimeoutManager .class );
38
38
39
39
/**
40
- * シングルトンのためのインスタンスです。
40
+ * Instance for the singleton.
41
41
*/
42
42
protected static final TimeoutManager instance = new TimeoutManager ();
43
43
44
44
/**
45
- * Timerのための {@link Thread}です。
45
+ * {@link Thread} for the timer.
46
46
*/
47
47
protected Thread thread ;
48
48
49
49
/**
50
- * {@link TimeoutTask}管理用のリストです。
50
+ * A list for managing {@link TimeoutTask}.
51
51
*/
52
52
protected final SLinkedList <TimeoutTask > timeoutTaskList = new SLinkedList <>();
53
53
54
54
private TimeoutManager () {
55
55
}
56
56
57
57
/**
58
- * シングルトン用のインスタンスを返します。
58
+ * Returns the instance for the singleton.
59
59
*
60
- * @return シングルトン用のインスタンス
60
+ * @return the instance for the singleton
61
61
*/
62
62
public static TimeoutManager getInstance () {
63
63
return instance ;
64
64
}
65
65
66
66
/**
67
- * 処理を開始します。
67
+ * Starts the process.
68
68
*/
69
69
public synchronized void start () {
70
70
if (thread == null ) {
@@ -78,7 +78,7 @@ public synchronized void start() {
78
78
}
79
79
80
80
/**
81
- * 処理を停止します。
81
+ * Stops the process.
82
82
*/
83
83
public synchronized void stop () {
84
84
if (thread != null ) {
@@ -91,13 +91,13 @@ public synchronized void stop() {
91
91
}
92
92
93
93
/**
94
- * スレッドに割り込みを行い、終了するまで待機します。
94
+ * Interrupts the thread and waits for it to terminate.
95
95
*
96
96
* @param timeoutMillis
97
- * 待機する時間(ミリ秒単位 )
98
- * @return スレッドが終了した場合は <code>true</code>
97
+ * The time to wait (in milliseconds )
98
+ * @return <code>true</code> if the thread has terminated
99
99
* @throws InterruptedException
100
- * 待機中に割り込まれた場合
100
+ * If interrupted while waiting
101
101
*/
102
102
public boolean stop (final long timeoutMillis ) throws InterruptedException {
103
103
final Thread t = this .thread ;
@@ -116,19 +116,19 @@ public boolean stop(final long timeoutMillis) throws InterruptedException {
116
116
}
117
117
118
118
/**
119
- * 管理している {@link TimeoutTask}をクリアします。
119
+ * Clears the managed {@link TimeoutTask}.
120
120
*/
121
121
public synchronized void clear () {
122
122
timeoutTaskList .clear ();
123
123
}
124
124
125
125
/**
126
- * {@link TimeoutTarget}を追加します。
126
+ * Adds a {@link TimeoutTarget}.
127
127
*
128
- * @param timeoutTarget target
129
- * @param timeout timeout
130
- * @param permanent permanent
131
- * @return {@link TimeoutTask}
128
+ * @param timeoutTarget the target
129
+ * @param timeout the timeout duration
130
+ * @param permanent whether the task is permanent
131
+ * @return the {@link TimeoutTask}
132
132
*/
133
133
public synchronized TimeoutTask addTimeoutTarget (final TimeoutTarget timeoutTarget , final int timeout , final boolean permanent ) {
134
134
final TimeoutTask task = new TimeoutTask (timeoutTarget , timeout , permanent );
@@ -138,9 +138,9 @@ public synchronized TimeoutTask addTimeoutTarget(final TimeoutTarget timeoutTarg
138
138
}
139
139
140
140
/**
141
- * 管理している {@link TimeoutTask}の数を返します。
141
+ * Returns the number of managed {@link TimeoutTask}.
142
142
*
143
- * @return 管理している {@link TimeoutTask}の数
143
+ * @return the number of managed {@link TimeoutTask}
144
144
*/
145
145
public synchronized int getTimeoutTaskCount () {
146
146
return timeoutTaskList .size ();
@@ -222,9 +222,9 @@ private synchronized boolean isInterrupted() {
222
222
}
223
223
224
224
/**
225
- * 期限の切れた {@link TimeoutTask}のリストを返します。
225
+ * Returns the list of expired {@link TimeoutTask}.
226
226
*
227
- * @return 期限の切れた {@link TimeoutTask}のリスト
227
+ * @return the list of expired {@link TimeoutTask}
228
228
*/
229
229
protected synchronized List <TimeoutTask > getExpiredTask () {
230
230
final List <TimeoutTask > expiredTask = new ArrayList <>();
@@ -246,9 +246,9 @@ protected synchronized List<TimeoutTask> getExpiredTask() {
246
246
}
247
247
248
248
/**
249
- * 管理しているタスクが無いなら処理を停止します。
249
+ * Stops the process if there are no managed tasks.
250
250
*
251
- * @return 停止したかどうか
251
+ * @return whether the process was stopped
252
252
*/
253
253
protected synchronized boolean stopIfLeisure () {
254
254
if (timeoutTaskList .isEmpty ()) {
0 commit comments