Source:
<code>private void handleRestoreInstanceStateRequest(InstanceControlMsg instanceControlMsg) { CheckpointManager.RestoreInstanceStateRequest request = instanceControlMsg.getRestoreInstanceStateRequest(); LOG.info("Restoring state to checkpoint id: " + request.getState().getCheckpointId()); isStatefulProcessingStarted = false; streamInCommunicator.clear(); metricsCollector.forceGatherAllMetrics(); slaveLooper.clearTasksOnWakeup(); slaveLooper.clearTimers(); slaveLooper.addTasksOnWakeup(this); metricsCollector = new MetricsCollector(slaveLooper, metricsOutCommunicator); if (instance != null) { instance.stop(); } instanceState.clear(); if (request.getState().hasState() && !request.getState().getState().isEmpty()) { @SuppressWarnings("unchecked") <START> Map<byte[], byte[]> stateToRestore = (Map<byte[], byte[]>) Utils.deserialize( <END> request.getState().getState().toByteArray()); instanceState.putAll(stateToRestore); } else { LOG.info("The restore request does not have an actual state"); } LOG.info("Instance state restored for checkpoint id: " + request.getState().getCheckpointId()); if (isInstanceStarted && helper != null) { LOG.info("Restarting instance"); resetCurrentAssignment(); } LOG.info("Acknowledge back the restore instance state response"); CheckpointManager.RestoreInstanceStateResponse response = CheckpointManager.RestoreInstanceStateResponse.newBuilder() .setCheckpointId(request.getState().getCheckpointId()) .build(); streamOutCommunicator.offer(response); }</code><technical_language>implies java default serialization/deserialization for state encoding. is good interface for it, similar tuple serialization/deserialization. Users provide implemented one, a default (java default kryo)</technical_language>

Target:
private void handleRestoreInstanceStateRequest(InstanceControlMsg instanceControlMsg) { CheckpointManager.RestoreInstanceStateRequest request = instanceControlMsg.getRestoreInstanceStateRequest(); LOG.info("Restoring state to checkpoint id: " + request.getState().getCheckpointId()); isStatefulProcessingStarted = false; streamInCommunicator.clear(); metricsCollector.forceGatherAllMetrics(); slaveLooper.clearTasksOnWakeup(); slaveLooper.clearTimers(); slaveLooper.addTasksOnWakeup(this); metricsCollector = new MetricsCollector(slaveLooper, metricsOutCommunicator); if (instance != null) { instance.stop(); } if (instanceState != null) { instanceState.clear(); } if (request.getState().hasState() && !request.getState().getState().isEmpty()) { @SuppressWarnings("unchecked") State<? extends Serializable, ? extends Serializable> stateToRestore = (State<? extends Serializable, ? extends Serializable>) serializer.deserialize( request.getState().getState().toByteArray()); instanceState = stateToRestore; } else { LOG.info("The restore request does not have an actual state"); } LOG.info("Instance state restored for checkpoint id: " + request.getState().getCheckpointId()); if (isInstanceStarted && helper != null) { LOG.info("Restarting instance"); resetCurrentAssignment(); } LOG.info("Acknowledge back the restore instance state response"); CheckpointManager.RestoreInstanceStateResponse response = CheckpointManager.RestoreInstanceStateResponse.newBuilder() .setCheckpointId(request.getState().getCheckpointId()) .build(); streamOutCommunicator.offer(response); }