/** {@inheritDoc} */
  @Override
  public void p2pUnmarshal(UUID nodeId, GridKernalContext ctx) throws GridException {
    assert nodeId != null;
    assert ctx != null;
    assert ctx.config().isPeerClassLoadingEnabled();

    GridDeployment dep =
        ctx.deploy()
            .getGlobalDeployment(
                depInfo.deployMode(),
                clsName,
                clsName,
                depInfo.userVersion(),
                nodeId,
                depInfo.classLoaderId(),
                depInfo.participants(),
                null);

    if (dep == null)
      throw new GridDeploymentException("Failed to obtain deployment for class: " + clsName);

    ClassLoader ldr = dep.classLoader();

    if (topicBytes != null) topic = ctx.config().getMarshaller().unmarshal(topicBytes, ldr);

    pred = ctx.config().getMarshaller().unmarshal(predBytes, ldr);
  }
  /** {@inheritDoc} */
  @Override
  public void p2pMarshal(GridKernalContext ctx) throws GridException {
    assert ctx != null;
    assert ctx.config().isPeerClassLoadingEnabled();

    if (topic != null) topicBytes = ctx.config().getMarshaller().marshal(topic);

    predBytes = ctx.config().getMarshaller().marshal(pred);

    GridPeerDeployAware pda = U.peerDeployAware0(topic, pred);

    clsName = pda.deployClass().getName();

    GridDeployment dep = ctx.deploy().deploy(pda.deployClass(), pda.classLoader());

    if (dep == null) throw new GridDeploymentException("Failed to deploy message listener.");

    depInfo = new GridDeploymentInfoBean(dep);

    depEnabled = true;
  }
  /**
   * @param spi Underlying SPI.
   * @param ctx Grid kernal context.
   * @param comm Deployment communication.
   */
  GridDeploymentStoreAdapter(
      GridDeploymentSpi spi, GridKernalContext ctx, GridDeploymentCommunication comm) {
    assert spi != null;
    assert ctx != null;
    assert comm != null;

    this.spi = spi;
    this.ctx = ctx;
    this.comm = comm;

    log = ctx.config().getGridLogger().getLogger(getClass());
  }
 /** @param ctx Grid kernal context. */
 public GridCollisionManager(GridKernalContext ctx) {
   super(ctx, ctx.config().getCollisionSpi());
 }
 /** @param ctx Grid kernal context. */
 public GridSecureSessionManager(GridKernalContext ctx) {
   super(GridSecureSessionSpi.class, ctx, ctx.config().getSecureSessionSpi());
 }