Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Nov 5, 2018
2 parents 22da526 + 4c1ae0d commit c09a06a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
Expand Up @@ -59,7 +59,6 @@ public static Collection<ResourceAttribute<?>> getPrimaryIdentifiers(ShadowType
return getPrimaryIdentifiers(shadowType.asPrismObject());
}

// TODO: rename to getPrimaryIdentifiers
public static Collection<ResourceAttribute<?>> getPrimaryIdentifiers(PrismObject<? extends ShadowType> shadow) {
ResourceAttributeContainer attributesContainer = getAttributesContainer(shadow);
if (attributesContainer == null) {
Expand Down
Expand Up @@ -1168,7 +1168,7 @@ public <T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<

SearchResultMetadata metadata;
try {
enterModelMethod();
enterModelMethodNoRepoCache(); // skip using cache to avoid potentially many objects there (MID-4615, MID-4959)
logQuery(processedQuery);

try {
Expand All @@ -1189,7 +1189,7 @@ public <T extends ObjectType> SearchResultMetadata searchObjectsIterative(Class<
}
}
} finally {
exitModelMethod();
exitModelMethodNoRepoCache();
}

// TODO: log errors
Expand Down Expand Up @@ -2234,11 +2234,19 @@ public PrismContext getPrismContext() {
}

private void enterModelMethod() {
clockworkMedic.enterModelMethod();
clockworkMedic.enterModelMethod(true);
}

private void enterModelMethodNoRepoCache() {
clockworkMedic.enterModelMethod(false);
}

private void exitModelMethod() {
clockworkMedic.exitModelMethod();
clockworkMedic.exitModelMethod(true);
}

private void exitModelMethodNoRepoCache() {
clockworkMedic.exitModelMethod(false);
}

//region Case Management
Expand Down
Expand Up @@ -52,7 +52,7 @@ public class ClockworkMedic {

private static final Trace LOGGER = TraceManager.getTrace(ClockworkMedic.class);

public void enterModelMethod() {
public void enterModelMethod(boolean enterCache) {
if (InternalsConfig.isModelProfiling()) {
DiagnosticContextManager manager = getDiagnosticContextManager();
DiagnosticContext ctx;
Expand All @@ -64,12 +64,16 @@ public void enterModelMethod() {
}
DiagnosticContextHolder.push(ctx);
}

RepositoryCache.enter();

if (enterCache) {
RepositoryCache.enter();
}
}

public void exitModelMethod() {
RepositoryCache.exit();
public void exitModelMethod(boolean exitCache) {
if (exitCache) {
RepositoryCache.exit();
}

DiagnosticContext ctx = DiagnosticContextHolder.pop();
if (ctx != null) {
Expand Down
Expand Up @@ -572,7 +572,7 @@ public AsynchronousOperationReturnValue<Collection<PropertyDelta<PrismPropertyVa
AsynchronousOperationReturnValue<Collection<PropertyModificationOperation>> modifyAsyncRet = null;

//check identifier if it is not null
if (primaryIdentifiers.isEmpty() && repoShadow.asObjectable().getFailedOperationType()!= null){
if ((primaryIdentifiers == null || primaryIdentifiers.isEmpty()) && repoShadow.asObjectable().getFailedOperationType() != null){
GenericConnectorException e = new GenericConnectorException(
"Unable to modify object in the resource. Probably it has not been created yet because of previous unavailability of the resource.");
result.recordFatalError(e);
Expand Down

0 comments on commit c09a06a

Please sign in to comment.