use of org.apache.karaf.profile.LockHandle in project karaf by apache.
the class ProfileServiceImpl method updateProfile.
@Override
@SuppressWarnings("unused")
public void updateProfile(Profile profile) {
assertNotNull(profile, "profile is null");
try (LockHandle lock = acquireWriteLock()) {
final String profileId = profile.getId();
final Profile lastProfile = getRequiredProfile(profileId);
createOrUpdateProfile(lastProfile, profile);
}
}
use of org.apache.karaf.profile.LockHandle in project karaf by apache.
the class ProfileServiceImpl method deleteProfile.
@Override
@SuppressWarnings("unused")
public void deleteProfile(String profileId) {
assertNotNull(profileId, "profileId is null");
try (LockHandle lock = acquireWriteLock()) {
final Profile lastProfile = getRequiredProfile(profileId);
deleteProfileFromCache(lastProfile);
}
}
use of org.apache.karaf.profile.LockHandle in project karaf by apache.
the class ProfileServiceImpl method getRequiredProfile.
@Override
@SuppressWarnings("unused")
public Profile getRequiredProfile(String profileId) {
assertNotNull(profileId, "profileId is null");
try (LockHandle lock = acquireReadLock()) {
Profile profile = getProfileFromCache(profileId);
assertNotNull(profile, "Profile does not exist: " + profileId);
return profile;
}
}
use of org.apache.karaf.profile.LockHandle in project karaf by apache.
the class ProfileServiceImpl method createProfile.
@Override
@SuppressWarnings("unused")
public void createProfile(Profile profile) {
assertNotNull(profile, "profile is null");
try (LockHandle lock = acquireWriteLock()) {
String profileId = profile.getId();
assertFalse(hasProfile(profileId), "Profile already exists: " + profileId);
createOrUpdateProfile(null, profile);
}
}
Aggregations