Skip to content

Commit

Permalink
Atomic, ascending group IDs for log correlation
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-allan committed Apr 2, 2020
1 parent 155fe6f commit 1003704
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.glencoesoftware.ldaptool;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -12,6 +13,8 @@

public class MockSimpleRoleProvider extends SimpleRoleProvider {

private AtomicLong nextExperimenterGroupId = new AtomicLong(1L);

private static final Logger log =
LoggerFactory.getLogger(MockSimpleRoleProvider.class);

Expand All @@ -27,11 +30,12 @@ public MockSimpleRoleProvider(SecuritySystem sec, SessionFactory sf,
@Override
public long createGroup(
String name, Permissions perms, boolean strict, boolean isLdap) {
long id = nextExperimenterGroupId.getAndIncrement();
log.info(
"Would have created ExperimenterGroup name={} perms={} strict={} " +
"isLdap={}", name, perms, strict, isLdap
"Would have created ExperimenterGroup id={} name={} perms={} " +
"strict={} isLdap={}", name, perms, strict, isLdap
);
return 1;
return id;
}

}

0 comments on commit 1003704

Please sign in to comment.