|
22 | 22 | import java.util.Deque;
|
23 | 23 |
|
24 | 24 | /**
|
25 |
| - * アプリケーションの終了時にリソースを破棄するためのユーティリティクラスです。 |
| 25 | + * Utility class for disposing of resources at the end of an application. |
26 | 26 | * <p>
|
27 |
| - * アプリケーションの終了時に破棄しなければならないリソースがある場合は、 {@link Disposable}を実装したクラスを作成し、 |
28 |
| - * このクラスに登録します。 |
| 27 | + * If there are resources that must be disposed of at the end of the application, |
| 28 | + * create a class that implements {@link Disposable} and register it with this class. |
29 | 29 | * </p>
|
30 | 30 | *
|
31 | 31 | * @author koichik
|
32 | 32 | */
|
33 | 33 | public abstract class DisposableUtil {
|
34 | 34 |
|
35 |
| - /** 登録済みの{@link Disposable} */ |
| 35 | + /** Registered {@link Disposable} */ |
36 | 36 | protected static final Deque<Disposable> disposables = newLinkedList();
|
37 | 37 |
|
38 | 38 | /**
|
39 |
| - * 破棄可能なリソースを登録します。 |
| 39 | + * Registers a disposable resource. |
40 | 40 | *
|
41 | 41 | * @param disposable
|
42 |
| - * 破棄可能なリソース。{@literal null}であってはいけません |
| 42 | + * A disposable resource. Must not be {@literal null}. |
43 | 43 | */
|
44 | 44 | public static synchronized void add(final Disposable disposable) {
|
45 | 45 | assertArgumentNotNull("disposable", disposable);
|
46 | 46 | disposables.addLast(disposable);
|
47 | 47 | }
|
48 | 48 |
|
49 | 49 | /**
|
50 |
| - * 破棄可能なリソースを先頭に登録します。 |
| 50 | + * Registers a disposable resource at the beginning. |
51 | 51 | * <p>
|
52 |
| - * リソースは登録された逆順に破棄されるため、先頭に登録されたリソースは最後に破棄されることになります。 |
| 52 | + * Resources are disposed of in the reverse order of their registration, so resources registered at the beginning will be disposed of last. |
53 | 53 | * </p>
|
54 | 54 | *
|
55 | 55 | * @param disposable
|
56 |
| - * 破棄可能なリソース。{@literal null}であってはいけません |
| 56 | + * A disposable resource. Must not be {@literal null}. |
57 | 57 | */
|
58 | 58 | public static synchronized void addFirst(final Disposable disposable) {
|
59 | 59 | assertArgumentNotNull("disposable", disposable);
|
60 | 60 | disposables.addFirst(disposable);
|
61 | 61 | }
|
62 | 62 |
|
63 | 63 | /**
|
64 |
| - * 破棄可能なリソースを登録解除します。 |
| 64 | + * Unregisters a disposable resource. |
65 | 65 | *
|
66 | 66 | * @param disposable
|
67 |
| - * 破棄可能なリソース。{@literal null}であってはいけません |
| 67 | + * A disposable resource. Must not be {@literal null}. |
68 | 68 | */
|
69 | 69 | public static synchronized void remove(final Disposable disposable) {
|
70 | 70 | assertArgumentNotNull("disposable", disposable);
|
71 | 71 | disposables.remove(disposable);
|
72 | 72 | }
|
73 | 73 |
|
74 | 74 | /**
|
75 |
| - * 登録済みのリソースを全て破棄します。 |
| 75 | + * Disposes of all registered resources. |
76 | 76 | */
|
77 | 77 | public static synchronized void dispose() {
|
78 | 78 | while (!disposables.isEmpty()) {
|
|
0 commit comments