MCPcopy Index your code
hub / github.com/apache/groovy / getAsync

Method getAsync

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

Returns the current value as an Awaitable. The awaitable completes after all previously queued updates have been applied, ensuring a consistent read. @return an awaitable holding the value after pending updates

()

Source from the content-addressed store, hash-verified

148 * @return an awaitable holding the value after pending updates
149 */
150 public Awaitable<T> getAsync() {
151 CompletableFuture<T> cf = new CompletableFuture<>();
152 updateExecutor.execute(() -> {
153 rwLock.readLock().lock();
154 try {
155 cf.complete(value);
156 } finally {
157 rwLock.readLock().unlock();
158 }
159 });
160 return GroovyPromise.of(cf);
161 }
162
163 /**
164 * Queues an update function to be applied to the current value.

Callers

nothing calls this directly

Calls 5

ofMethod · 0.95
executeMethod · 0.45
lockMethod · 0.45
completeMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected