MCPcopy Create free account
hub / github.com/apache/groovy / shutdown

Method shutdown

src/main/java/groovy/concurrent/Agent.java:205–223  ·  view source on GitHub ↗

Shuts down the agent's update executor. No further updates will be accepted. Pending updates are executed before shutdown completes. The changes publisher (if any subscribers attached) is closed after pending updates drain, signalling onComplete to all live subscribers. Calling {@code shutdo

()

Source from the content-addressed store, hash-verified

203 * subscribers. Calling {@code shutdown()} more than once is a no-op.
204 */
205 public void shutdown() {
206 SubmissionPublisher<T> p;
207 synchronized (lifecycleLock) {
208 if (shutdownInvoked) return;
209 shutdownInvoked = true;
210 p = changesPublisher;
211 }
212 if (p != null) {
213 // Submit close as a terminator task so it runs after any queued
214 // updates have drained — ensures applyUpdate never offers to a
215 // publisher that has already been closed.
216 try {
217 updateExecutor.execute(p::close);
218 } catch (RejectedExecutionException ex) {
219 p.close();
220 }
221 }
222 updateExecutor.shutdown();
223 }
224
225 /**
226 * Returns a {@link Flow.Publisher} that emits the agent's value after

Callers

nothing calls this directly

Calls 3

closeMethod · 0.65
shutdownMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected