예제 #1
0
  /** {@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);
  }
예제 #2
0
  /** {@inheritDoc} */
  @Override
  public boolean register(UUID nodeId, UUID routineId, final GridKernalContext ctx)
      throws GridException {
    ctx.io().addUserMessageListener(topic, pred);

    return true;
  }
예제 #3
0
  /** {@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;
  }
예제 #4
0
 /** {@inheritDoc} */
 @Override
 public void unregister(UUID routineId, GridKernalContext ctx) {
   ctx.io().removeUserMessageListener(topic, pred);
 }