public void doVerb(final MessageIn<CounterMutation> message, final int id) { long queryStartNanoTime = System.nanoTime(); final CounterMutation cm = message.payload; logger.trace("Applying forwarded {}", cm); String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress()); // We should not wait for the result of the write in this thread, // otherwise we could have a distributed deadlock between replicas // running this VerbHandler (see #4578). // Instead, we use a callback to send the response. Note that the callback // will not be called if the request timeout, but this is ok // because the coordinator of the counter mutation will timeout on // it's own in that case. StorageProxy.applyCounterMutationOnLeader(cm, localDataCenter, new Runnable() { public void run() { MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }, queryStartNanoTime); } }
public void doVerb(final MessageIn<CounterMutation> message, final int id) { long queryStartNanoTime = System.nanoTime(); final CounterMutation cm = message.payload; logger.trace("Applying forwarded {}", cm); String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress()); // We should not wait for the result of the write in this thread, // otherwise we could have a distributed deadlock between replicas // running this VerbHandler (see #4578). // Instead, we use a callback to send the response. Note that the callback // will not be called if the request timeout, but this is ok // because the coordinator of the counter mutation will timeout on // it's own in that case. StorageProxy.applyCounterMutationOnLeader(cm, localDataCenter, new Runnable() { public void run() { MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }, queryStartNanoTime); } }
public void doVerb(final MessageIn<CounterMutation> message, final int id) { long queryStartNanoTime = System.nanoTime(); final CounterMutation cm = message.payload; logger.trace("Applying forwarded {}", cm); String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress()); // We should not wait for the result of the write in this thread, // otherwise we could have a distributed deadlock between replicas // running this VerbHandler (see #4578). // Instead, we use a callback to send the response. Note that the callback // will not be called if the request timeout, but this is ok // because the coordinator of the counter mutation will timeout on // it's own in that case. StorageProxy.applyCounterMutationOnLeader(cm, localDataCenter, new Runnable() { public void run() { MessagingService.instance().sendReply(WriteResponse.createMessage(), id, message.from); } }, queryStartNanoTime); } }
public void doVerb(final MessageIn<CounterMutation> message, final int id) { try { final CounterMutation cm = message.payload; logger.debug("Applying forwarded {}", cm); String localDataCenter = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress()); // We should not wait for the result of the write in this thread, // otherwise we could have a distributed deadlock between replicas // running this VerbHandler (see #4578). // Instead, we use a callback to send the response. Note that the callback // will not be called if the request timeout, but this is ok // because the coordinator of the counter mutation will timeout on // it's own in that case. StorageProxy.applyCounterMutationOnLeader(cm, localDataCenter, new Runnable() { public void run() { MessagingService.instance().sendReply(new WriteResponse().createMessage(), id, message.from); } }); } catch (RequestExecutionException e) { // The coordinator will timeout on it's own so ignore logger.debug("counter error", e); } } }