server.setStopTimeout(shutdownGracePeriod.toMilliseconds());
return server;
}
protected SetUIDListener buildSetUIDListener() {
final SetUIDListener listener = new SetUIDListener();
if (startsAsRoot != null) {
listener.setStartServerAsPrivileged(startsAsRoot);
}
if (gid != null) {
listener.setGid(gid);
}
if (uid != null) {
listener.setUid(uid);
}
if (user != null) {
listener.setUsername(user);
}
if (group != null) {
listener.setGroupname(group);
}
if (nofileHardLimit != null || nofileSoftLimit != null) {
final RLimit rlimit = new RLimit();
if (nofileHardLimit != null) {
rlimit.setHard(nofileHardLimit);
}
if (nofileSoftLimit != null) {
rlimit.setSoft(nofileSoftLimit);
}
listener.setRLimitNoFiles(rlimit);
}
if (umask != null) {
listener.setUmaskOctal(umask);
}
return listener;
}