private synchronized void activateProfile(boolean validate) throws Exception { if (this.profileService == null) { throw new IllegalStateException("Must configure the ProfileService"); } ProfileKey profKey = getProfileKey(); if (this.profileService.getActiveProfileKeys().contains(profKey) == false) { this.profileService.activateProfile(profKey); if (validate) { // Validate if the activation was successful this.profileService.validateProfile(profKey); } this.activated = true; } else { log.warn("Profile " + profKey + " is already activated"); this.activated = true; } }
if (profileService.getActiveProfileKeys().contains(profKey))
/** * Unregisters the profile registered in {@link #start()}. */ public void stop() throws Exception { ProfileService profSvc = getProfileService(); ProfileKey profKey = getProfileKey(); if (profSvc != null && profKey != null) { try { // Inactivate first if needed if (profSvc.getActiveProfileKeys().contains(profKey)) { releaseProfile(); } profSvc.unregisterProfile(profKey); } catch (NoSuchProfileException e) { log.warn("Could not unregister unknown profile " + profKey); } } }
if (profileService.getActiveProfileKeys().contains(profKey))
if (this.profileService.getActiveProfileKeys().contains(profKey) == false)