Skip to content

Commit

Permalink
DG-1697: Adding threadpool for linking/unlink policy
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit-at committed Jul 15, 2024
1 parent 4568dc3 commit 8c35a11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public enum AtlasConfiguration {

INDEXSEARCH_ASYNC_SEARCH_KEEP_ALIVE_TIME_IN_SECONDS("atlas.indexsearch.async.search.keep.alive.time.in.seconds", 300),

POLICY_OPERATIONS_NOTIFICATION_MAX_THREADS("atlas.policy.operations.max.threads", 5),
ATLAS_MAINTENANCE_MODE("atlas.maintenance.mode", false);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


import com.google.common.annotations.VisibleForTesting;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.DeleteType;
import org.apache.atlas.GraphTransactionInterceptor;
Expand Down Expand Up @@ -105,6 +106,8 @@
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;

import static java.lang.Boolean.FALSE;
Expand Down Expand Up @@ -152,6 +155,8 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {

private final ESAliasStore esAliasStore;

private final ExecutorService executorService;

@Inject
public AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, RestoreHandlerV1 restoreHandlerV1, AtlasTypeRegistry typeRegistry,
IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper, TaskManagement taskManagement,
Expand All @@ -169,6 +174,11 @@ public AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate
this.atlasRelationshipStore = atlasRelationshipStore;
this.featureFlagStore = featureFlagStore;
this.esAliasStore = new ESAliasStore(graph, entityRetriever);
this.executorService = Executors.newFixedThreadPool(AtlasConfiguration.POLICY_OPERATIONS_NOTIFICATION_MAX_THREADS.getInt(),
new ThreadFactoryBuilder()
.setNameFormat("atlas-policy-operations-notification-%d")
.build()
);

try {
this.discovery = new EntityDiscoveryService(typeRegistry, graph, null, null, null, null);
Expand Down Expand Up @@ -2785,7 +2795,7 @@ public void unlinkBusinessPolicy(String guid, List<String> unlinkGuids) throws A
} finally {
RequestContext.clear();
}
});
}, this.executorService);
RequestContext.get().endMetricRecord(metric);
}
}
Expand Down

0 comments on commit 8c35a11

Please sign in to comment.