/** @see JournalProtocol#heartbeat */ @Override public HeartbeatResponseProto heartbeat(RpcController controller, HeartbeatRequestProto req) throws ServiceException { try { impl.heartbeat(convert(req.getReqInfo())); } catch (IOException e) { throw new ServiceException(e); } return HeartbeatResponseProto.getDefaultInstance(); }
/** * When we've entered an out-of-sync state, it's still useful to periodically * send an empty RPC to the server, such that it has the up to date * committedTxId. This acts as a sanity check during recovery, and also allows * that node's metrics to be up-to-date about its lag. * * In the future, this method may also be used in order to check that the * current node is still the current writer, even if no edits are being * written. */ private void heartbeatIfNecessary() throws IOException { if (lastHeartbeatStopwatch.now(TimeUnit.MILLISECONDS) > HEARTBEAT_INTERVAL_MILLIS || !lastHeartbeatStopwatch.isRunning()) { try { getProxy().heartbeat(createReqInfo()); } finally { // Don't send heartbeats more often than the configured interval, // even if they fail. lastHeartbeatStopwatch.reset().start(); } } }
/** @see JournalProtocol#heartbeat */ @Override public HeartbeatResponseProto heartbeat(RpcController controller, HeartbeatRequestProto req) throws ServiceException { try { impl.heartbeat(convert(req.getReqInfo())); } catch (IOException e) { throw new ServiceException(e); } return HeartbeatResponseProto.getDefaultInstance(); }
/** @see JournalProtocol#heartbeat */ @Override public HeartbeatResponseProto heartbeat(RpcController controller, HeartbeatRequestProto req) throws ServiceException { try { impl.heartbeat(convert(req.getReqInfo())); } catch (IOException e) { throw new ServiceException(e); } return HeartbeatResponseProto.getDefaultInstance(); }
/** * When we've entered an out-of-sync state, it's still useful to periodically * send an empty RPC to the server, such that it has the up to date * committedTxId. This acts as a sanity check during recovery, and also allows * that node's metrics to be up-to-date about its lag. * * In the future, this method may also be used in order to check that the * current node is still the current writer, even if no edits are being * written. */ private void heartbeatIfNecessary() throws IOException { if (lastHeartbeatStopwatch.now(TimeUnit.MILLISECONDS) > HEARTBEAT_INTERVAL_MILLIS || !lastHeartbeatStopwatch.isRunning()) { try { getProxy().heartbeat(createReqInfo()); } finally { // Don't send heartbeats more often than the configured interval, // even if they fail. lastHeartbeatStopwatch.reset().start(); } } }
/** * When we've entered an out-of-sync state, it's still useful to periodically * send an empty RPC to the server, such that it has the up to date * committedTxId. This acts as a sanity check during recovery, and also allows * that node's metrics to be up-to-date about its lag. * * In the future, this method may also be used in order to check that the * current node is still the current writer, even if no edits are being * written. */ private void heartbeatIfNecessary() throws IOException { if (lastHeartbeatStopwatch.now(TimeUnit.MILLISECONDS) > HEARTBEAT_INTERVAL_MILLIS || !lastHeartbeatStopwatch.isRunning()) { try { getProxy().heartbeat(createReqInfo()); } finally { // Don't send heartbeats more often than the configured interval, // even if they fail. lastHeartbeatStopwatch.reset().start(); } } }
Mockito.eq(1), Mockito.same(FAKE_DATA)); Mockito.verify(mockProxy).heartbeat( Mockito.<RequestInfo>any());