use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class SegmentCache method getSegment.
/**
* Retrieve an segment from the cache or load it and cache it if not yet in the cache.
* @param id the id of the segment
* @param loader the loader to load the segment if not yet in the cache
* @return the segment identified by {@code id}
* @throws ExecutionException when {@code loader} failed to load an segment
*/
@Nonnull
public Segment getSegment(@Nonnull final SegmentId id, @Nonnull final Callable<Segment> loader) throws ExecutionException {
// Load bulk segment directly without putting it in cache
try {
if (id.isBulkSegmentId()) {
return loader.call();
}
} catch (Exception e) {
throw new ExecutionException(e);
}
// Load data segment and put it in the cache
try {
long t0 = System.nanoTime();
Segment segment = loader.call();
stats.loadSuccessCount.incrementAndGet();
stats.loadTime.addAndGet(System.nanoTime() - t0);
stats.missCount.incrementAndGet();
return put(id, segment);
} catch (Exception e) {
stats.loadExceptionCount.incrementAndGet();
throw new ExecutionException(e);
}
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class SegmentNodeStore method reset.
@Override
@Nonnull
public NodeState reset(@Nonnull NodeBuilder builder) {
checkArgument(builder instanceof SegmentNodeBuilder);
SegmentNodeBuilder snb = (SegmentNodeBuilder) builder;
NodeState root = getRoot();
snb.reset(root);
return root;
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class MembershipBaseTest method createMembers.
@Nonnull
List<String> createMembers(@Nonnull Group g, int cnt) throws Exception {
List<String> memberPaths = new ArrayList();
for (int i = 0; i <= cnt; i++) {
User u = createUser();
Group gr = createGroup();
g.addMembers(u.getID(), gr.getID());
memberPaths.add(u.getPath());
memberPaths.add(gr.getPath());
}
return memberPaths;
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class MembershipBaseTest method createGroup.
@Nonnull
Group createGroup() throws RepositoryException {
String groupName = "testGroup" + testGroups.size();
Group grp = userMgr.createGroup(groupName);
testGroups.add(grp.getPath());
return grp;
}
use of javax.annotation.Nonnull in project jackrabbit-oak by apache.
the class PasswordExpiryHistoryTest method getSecurityConfigParameters.
@Override
protected ConfigurationParameters getSecurityConfigParameters() {
final PasswordValidationAction pwAction = new PasswordValidationAction();
pwAction.init(null, ConfigurationParameters.of(PasswordValidationAction.CONSTRAINT, "^.*(?=.{4,}).*"));
final AuthorizableActionProvider actionProvider = new AuthorizableActionProvider() {
@Nonnull
@Override
public List<? extends AuthorizableAction> getAuthorizableActions(@Nonnull SecurityProvider securityProvider) {
return ImmutableList.of(pwAction);
}
};
ConfigurationParameters userConfig = ConfigurationParameters.of(ImmutableMap.of(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, actionProvider, UserConstants.PARAM_PASSWORD_MAX_AGE, 10, UserConstants.PARAM_PASSWORD_HISTORY_SIZE, 10));
return ConfigurationParameters.of(UserConfiguration.NAME, userConfig);
}
Aggregations