}
}
}
private void resolve() throws CruiseControlException {
Resolver resolver = lookupService.createResolver(false, false, this.isResolveUsers(), this.isResolveGroups());
resolver.addResolveListener(this);
try {
this.recipientUserSet = new HashSet();
this.recipientGroupSet = new HashSet();
this.resolvedNameSet = new HashSet();
if (LOG.isDebugEnabled()) {
LOG.debug("resolving: " + this.usernamesToResolveSet);
}
resolver.resolve(
(String[]) this.usernamesToResolveSet.toArray(new String[this.usernamesToResolveSet.size()]));
// how long do we wait to resolve?
boolean bored = false;
long waitStart = System.currentTimeMillis();
while (!this.isResolvedAllUsersAndGroups() && !bored && !this.isResolveError()) {
try {
Thread.sleep(this.getSleepMillis());
} catch (InterruptedException ex) {
throw new RuntimeException("sleep interrupted: " + ex);
}
bored = System.currentTimeMillis() - waitStart > this.getTimeoutMillis();
}
if (this.resolveFailMessage != null
&& RESOLVE_FAIL_ERROR.equalsIgnoreCase(this.getHandleResolveFails())) {
throw new CruiseControlException(this.resolveFailMessage);
}
if (this.resolveConflictMessage != null
&& RESOLVE_CONFLICTS_ERROR.equalsIgnoreCase(this.getHandleResolveConflicts())) {
throw new CruiseControlException(this.resolveConflictMessage);
}
if (bored && !this.isResolvedAllUsersAndGroups()) {
throw new CruiseControlException("bored waiting for user/group resolving");
}
} finally {
resolver.removeResolveListener(this);
}
}