MCPcopy Index your code
hub / github.com/clojure/clojure / restart

Method restart

src/jvm/clojure/lang/Agent.java:207–232  ·  view source on GitHub ↗
(Object newState, boolean clearActions)

Source from the content-addressed store, hash-verified

205}
206
207synchronized public Object restart(Object newState, boolean clearActions){
208 if(getError() == null)
209 {
210 throw Util.runtimeException("Agent does not need a restart");
211 }
212 validate(newState);
213 state = newState;
214
215 if(clearActions)
216 aq.set(ActionQueue.EMPTY);
217 else
218 {
219 boolean restarted = false;
220 ActionQueue prior = null;
221 while(!restarted)
222 {
223 prior = aq.get();
224 restarted = aq.compareAndSet(prior, new ActionQueue(prior.q, null));
225 }
226
227 if(prior.q.count() > 0)
228 ((Action) prior.q.peek()).execute();
229 }
230
231 return newState;
232}
233
234public Object dispatch(IFn fn, ISeq args, Executor exec) {
235 Throwable error = getError();

Callers

nothing calls this directly

Calls 9

getErrorMethod · 0.95
runtimeExceptionMethod · 0.95
validateMethod · 0.80
getMethod · 0.65
compareAndSetMethod · 0.65
countMethod · 0.65
peekMethod · 0.65
setMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected