String errMsg = "User " + user
+ " failed to kill the following job(s)!<br><br>";
for (String job : jobs) {
final JobID jobId = JobID.forName(job);
if (user != null) {
UserGroupInformation ugi =
UserGroupInformation.createRemoteUser(user);
try {
ugi.doAs(new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException{
tracker.killJob(jobId);// checks job modify permission
return null;
}
});
} catch(AccessControlException e) {
errMsg = errMsg.concat("<br>" + e.getMessage());
notAuthorized = true;
// We don't return right away so that we can try killing other
// jobs that are requested to be killed.
continue;
}
}
else {// no authorization needed
tracker.killJob(jobId);
}
}
if (notAuthorized) {// user is not authorized to kill some/all of jobs
errMsg = errMsg.concat(
"<br><hr><a href=\"jobtracker.jsp\">Go back to JobTracker</a><br>");
setErrorAndForward(errMsg, request, response);
return;
}
}
}
if (privateActionsAllowed(tracker.conf) &&
request.getParameter("changeJobPriority") != null) {
String[] jobs = request.getParameterValues("jobCheckBox");
if (jobs != null) {
final JobPriority jobPri = JobPriority.valueOf(request
.getParameter("setJobPriority"));
boolean notAuthorized = false;
String errMsg = "User " + user
+ " failed to set priority for the following job(s)!<br><br>";
for (String job : jobs) {
final JobID jobId = JobID.forName(job);
if (user != null) {
UserGroupInformation ugi = UserGroupInformation.
createRemoteUser(user);
try {
ugi.doAs(new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException{
// checks job modify permission
tracker.setJobPriority(jobId, jobPri);
return null;