Cleans up any outstanding or lingering RPC (used when shutting down). All RPCs in flight will fail with a ConnectionResetException and all edits buffered will be re-scheduled.
(final Channel chan)
| 1176 | * all edits buffered will be re-scheduled. |
| 1177 | */ |
| 1178 | private void cleanup(final Channel chan) { |
| 1179 | final ConnectionResetException exception = |
| 1180 | new ConnectionResetException(chan); |
| 1181 | failOrRetryRpcs(rpcs_inflight.values(), exception); |
| 1182 | rpcs_inflight.clear(); |
| 1183 | |
| 1184 | final ArrayList<HBaseRpc> rpcs; |
| 1185 | final MultiAction batch; |
| 1186 | synchronized (this) { |
| 1187 | dead = true; |
| 1188 | rpcs = pending_rpcs; |
| 1189 | pending_rpcs = null; |
| 1190 | batch = batched_rpcs; |
| 1191 | batched_rpcs = null; |
| 1192 | } |
| 1193 | if (rpcs != null) { |
| 1194 | failOrRetryRpcs(rpcs, exception); |
| 1195 | } |
| 1196 | if (batch != null) { |
| 1197 | batch.callback(exception); // Make it fail. |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | /** |
| 1202 | * Fail all RPCs in a collection or attempt to reschedule them if possible. |
no test coverage detected