Creates callbacks to handle a single-put and adds them to the request. @param edit The edit for which we must handle the response.
(final BatchableRpc edit)
| 954 | * @param edit The edit for which we must handle the response. |
| 955 | */ |
| 956 | private void addSingleEditCallbacks(final BatchableRpc edit) { |
| 957 | // There's no callback to add on a single put request, because |
| 958 | // the remote method returns `void', so we only need an errback. |
| 959 | final class SingleEditErrback implements Callback<Object, Exception> { |
| 960 | public Object call(final Exception e) { |
| 961 | if (!(e instanceof RecoverableException)) { |
| 962 | return e; // Can't recover from this error, let it propagate. |
| 963 | } |
| 964 | return retryEdit(edit, (RecoverableException) e); |
| 965 | } |
| 966 | public String toString() { |
| 967 | return "single-edit errback"; |
| 968 | } |
| 969 | }; |
| 970 | edit.getDeferred().addErrback(new SingleEditErrback()); |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * Sends an RPC out to the wire, or queues it if we're disconnected. |
no test coverage detected