Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCheckedException;
Expand Down Expand Up @@ -153,9 +152,6 @@ public class GridTaskProcessor extends GridProcessorAdapter implements IgniteCha
/** Internal metadata cache. */
private volatile IgniteInternalCache<GridTaskNameHashKey, String> tasksMetaCache;

/** */
private final CountDownLatch startLatch = new CountDownLatch(1);

/**
* {@code true} if local node has persistent region in configuration and is not a client.
*/
Expand Down Expand Up @@ -210,16 +206,6 @@ public GridTaskProcessor(GridKernalContext ctx) {
log.debug("Started task processor.");
}

/** {@inheritDoc} */
@Override public void onKernalStart(boolean active) throws IgniteCheckedException {
if (!active)
return;

tasksMetaCache = ctx.security().enabled() ? ctx.cache().utilityCache() : null;

startLatch.countDown();
}

/** {@inheritDoc} */
@Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
IgniteClientDisconnectedCheckedException err = disconnectedError(reconnectFut);
Expand Down Expand Up @@ -271,8 +257,6 @@ private IgniteClientDisconnectedCheckedException disconnectedError(@Nullable Ign
Thread.currentThread().interrupt();
}

startLatch.countDown();

int size = tasks.size();

if (size > 0) {
Expand Down Expand Up @@ -342,8 +326,8 @@ private IgniteClientDisconnectedCheckedException disconnectedError(@Nullable Ign
private IgniteInternalCache<GridTaskNameHashKey, String> taskMetaCache() {
assert ctx.security().enabled();

if (tasksMetaCache == null)
U.awaitQuiet(startLatch);
if (tasksMetaCache == null && ctx.state().publicApiActiveState(false))
tasksMetaCache = ctx.cache().utilityCache();

return tasksMetaCache;
}
Expand Down Expand Up @@ -865,6 +849,9 @@ private void saveTaskMetadata(String taskName) throws IgniteCheckedException {

IgniteInternalCache<GridTaskNameHashKey, String> tasksMetaCache = taskMetaCache();

if (tasksMetaCache == null)
return;

String existingName = tasksMetaCache.get(key);

if (existingName == null)
Expand Down Expand Up @@ -1178,7 +1165,7 @@ public boolean cancel(IgniteUuid sesId) {

/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
onKernalStart(true);
// No-op.
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public void testResolveTaskNameOnInactiveCluster() throws Exception {

ignite.cluster().state(ClusterState.INACTIVE);

ignite.compute().withName(TASK_NAME).run(() -> {});

assertNull(grid(1).context().task().resolveTaskName(TASK_NAME.hashCode()));

ignite.cluster().state(ClusterState.ACTIVE);
Expand Down
Loading