public void run() {
String methodDesc = null;
try {
VersionedProtocol proxy = _shardManager.getProxy(_node, false);
if (proxy == null) {
throw new KattaException("No proxy for node: " + _node);
}
if (_shardArrayIndex >= 0) {
// We need to pass the list of shards to the server's method.
_args[_shardArrayIndex] = _shards.toArray(new String[_shards.size()]);
}
long startTime = 0;
if (LOG.isTraceEnabled()) {
methodDesc = describeMethodCall(_method, _args, _node);
LOG.trace(String.format("About to invoke %s using proxy %s (id=%d)", methodDesc, Proxy
.getInvocationHandler(proxy), instanceId));
startTime = System.currentTimeMillis();
}
T result = (T) _method.invoke(proxy, _args);
_shardManager.reportNodeCommunicationSuccess(_node);
if (LOG.isTraceEnabled()) {
LOG.trace(String.format("Calling %s returned %s, took %d msec (id=%d)", methodDesc, resultToString(result),
(System.currentTimeMillis() - startTime), instanceId));
String methodDesc2 = describeMethodCall(_method, _args, _node);
if (!methodDesc.equals(methodDesc2)) {
LOG.error(String.format("Method call changed from %s to %s (id=%d)", methodDesc, methodDesc2, instanceId));
}
}
_result.addResult(result, _shards);
} catch (Throwable t) {
// Notify the work queue, so it can mark the node as down.
_shardManager.reportNodeCommunicationFailure(_node, t);
if (_tryCount >= _maxTryCount) {
LOG.error(String.format("Error calling %s (try # %d of %d) (id=%d)", (methodDesc != null ? methodDesc : _method
+ " on " + _node), _tryCount, _maxTryCount, instanceId), t);
_result.addError(new KattaException(String.format("%s for shards %s failed (id=%d)",
getClass().getSimpleName(), _shards, instanceId), t), _shards);
return;
}
if (!_result.isClosed()) {
try {