/**
     * Called to record all undeployed classes..
     *
     * @param leftNodeId Left node ID.
     */
    void recordUndeployed(@Nullable UUID leftNodeId) {
      assert !Thread.holdsLock(mux);

      for (Map.Entry<String, Class<?>> depCls : deployedClassMap().entrySet()) {
        boolean isTask = isTask(depCls.getValue());

        String msg =
            (isTask ? "Task" : "Class")
                + " was undeployed in SHARED or CONTINUOUS mode: "
                + depCls.getValue();

        int type = isTask ? EVT_TASK_UNDEPLOYED : EVT_CLASS_UNDEPLOYED;

        if (ctx.event().isRecordable(type)) {
          GridDeploymentEvent evt = new GridDeploymentEvent();

          evt.nodeId(ctx.localNodeId());
          evt.message(msg);
          evt.type(type);
          evt.alias(depCls.getKey());

          ctx.event().record(evt);
        }

        if (log.isInfoEnabled()) log.info(msg);
      }

      if (isObsolete()) {
        // Resource cleanup.
        ctx.resource().onUndeployed(this);

        ctx.cache().onUndeployed(leftNodeId, loader());

        clearSerializationCaches();
      }
    }
    /** {@inheritDoc} */
    @Override
    public void onDeployed(Class<?> cls) {
      assert !Thread.holdsLock(mux);

      boolean isTask = isTask(cls);

      String msg =
          (isTask ? "Task" : "Class") + " was deployed in SHARED or CONTINUOUS mode: " + cls;

      int type = isTask ? EVT_TASK_DEPLOYED : EVT_CLASS_DEPLOYED;

      if (ctx.event().isRecordable(type)) {
        GridDeploymentEvent evt = new GridDeploymentEvent();

        evt.nodeId(ctx.localNodeId());
        evt.message(msg);
        evt.type(type);
        evt.alias(cls.getName());

        ctx.event().record(evt);
      }

      if (log.isInfoEnabled()) log.info(msg);
    }