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

Method doRun

src/jvm/clojure/lang/Agent.java:105–160  ·  view source on GitHub ↗
(Action action)

Source from the content-addressed store, hash-verified

103 }
104
105 static void doRun(Action action){
106 try
107 {
108 nested.set(PersistentVector.EMPTY);
109
110 Throwable error = null;
111 try
112 {
113 Object oldval = action.agent.state;
114 Object newval = action.fn.applyTo(RT.cons(action.agent.state, action.args));
115 action.agent.setState(newval);
116 action.agent.notifyWatches(oldval,newval);
117 }
118 catch(Throwable e)
119 {
120 error = e;
121 }
122
123 if(error == null)
124 {
125 releasePendingSends();
126 }
127 else
128 {
129 nested.set(null); // allow errorHandler to send
130 if(action.agent.errorHandler != null)
131 {
132 try
133 {
134 action.agent.errorHandler.invoke(action.agent, error);
135 }
136 catch(Throwable e) {} // ignore errorHandler errors
137 }
138 if(action.agent.errorMode == CONTINUE)
139 {
140 error = null;
141 }
142 }
143
144 boolean popped = false;
145 ActionQueue next = null;
146 while(!popped)
147 {
148 ActionQueue prior = action.agent.aq.get();
149 next = new ActionQueue(prior.q.pop(), error);
150 popped = action.agent.aq.compareAndSet(prior, next);
151 }
152
153 if(error == null && next.q.count() > 0)
154 ((Action) next.q.peek()).execute();
155 }
156 finally
157 {
158 nested.set(null);
159 }
160 }
161
162 public void run(){

Callers 1

runMethod · 0.95

Calls 13

consMethod · 0.95
setStateMethod · 0.80
notifyWatchesMethod · 0.80
releasePendingSendsMethod · 0.80
applyToMethod · 0.65
invokeMethod · 0.65
getMethod · 0.65
popMethod · 0.65
compareAndSetMethod · 0.65
countMethod · 0.65
peekMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected