IJobKey jobKey = JobKeys.assertValid(IJobKey.build(mutableJobKey));
checkNotBlank(shardIds);
requireNonNull(session);
Response response = Util.emptyResponse();
SessionContext context;
try {
context = sessionValidator.checkAuthenticated(session, ImmutableSet.of(jobKey.getRole()));
} catch (AuthFailedException e) {
return addMessage(response, AUTH_FAILED, e);
}
try {
lockManager.validateIfLocked(
ILockKey.build(LockKey.job(jobKey.newBuilder())),
Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));
schedulerCore.restartShards(jobKey, shardIds, context.getIdentity());
response.setResponseCode(OK);
} catch (LockException e) {
addMessage(response, LOCK_ERROR, e);
} catch (ScheduleException e) {
addMessage(response, INVALID_REQUEST, e);
}