103
104 /**
105 * {@inheritDoc}
106 *
107 * <p>
108 * This implementation calls {@code run(List<T> args)} mehtod
109 * with the list of accumulated arguments.
110 */
111 public final void run() {
112 run(flush());
113 }
114
115 /**
116 * appends arguments and sends this {@cod Runnable} for the
117 * execution if needed.
118 * <p>
119 * This implementation uses {@see #submit} to send this
120 * {@code Runnable} for execution.
121 * @param args the arguments to accumulate
122 */
123 public final synchronized void add(T... args) {
124 boolean isSubmitted = true;
125 if (arguments == null) {
126 isSubmitted = false;
127 arguments = new ArrayList<T>();
128 }
129 Collections.addAll(arguments, args);
130 if (!isSubmitted) {
131 submit();
132 }
133 }
134
135 /**
136 * Sends this {@code Runnable} for the execution
137 *
138 * <p>
139 * This method is to be executed only from {@code add} method.
140 *
141 * <p>
142 * This implementation uses {@code SwingWorker.invokeLater}.
|
103
104 /**
105 * {@inheritDoc}
106 *
107 * <p>
108 * This implementation calls {@code run(List<T> args)} mehtod
109 * with the list of accumulated arguments.
110 */
111 public final void run() {
112 run(flush());
113 }
114
115 /**
116 * appends arguments and sends this {@cod Runnable} for the
117 * execution if needed.
118 * <p>
119 * This implementation uses {@see #submit} to send this
120 * {@code Runnable} for execution.
121 * @param args the arguments to accumulate
122 */
123 @SafeVarargs
124 public final synchronized void add(T... args) {
125 boolean isSubmitted = true;
126 if (arguments == null) {
127 isSubmitted = false;
128 arguments = new ArrayList<T>();
129 }
130 Collections.addAll(arguments, args);
131 if (!isSubmitted) {
132 submit();
133 }
134 }
135
136 /**
137 * Sends this {@code Runnable} for the execution
138 *
139 * <p>
140 * This method is to be executed only from {@code add} method.
141 *
142 * <p>
143 * This implementation uses {@code SwingWorker.invokeLater}.
|