Exemplo n.º 1
0
    /** {@inheritDoc} */
    @Override
    public ClassLoader classLoader() {
      if (ldr == null) {
        ClassLoader ldr0 = deployClass().getClassLoader();

        // Safety.
        if (ldr0 == null) ldr0 = U.gridClassLoader();

        assert ldr0 != null : "Failed to detect classloader [objs=" + objs + ']';

        ldr = ldr0;
      }

      return ldr;
    }
Exemplo n.º 2
0
    /** @param res Response. */
    void onResponse(GridDataLoadResponse res) {
      if (log.isDebugEnabled()) log.debug("Received data load response: " + res);

      GridFutureAdapter<?> f = reqs.remove(res.requestId());

      if (f == null) {
        if (log.isDebugEnabled())
          log.debug("Future for request has not been found: " + res.requestId());

        return;
      }

      Throwable err = null;

      byte[] errBytes = res.errorBytes();

      if (errBytes != null) {
        try {
          GridPeerDeployAware jobPda0 = jobPda;

          err =
              ctx.config()
                  .getMarshaller()
                  .unmarshal(
                      errBytes, jobPda0 != null ? jobPda0.classLoader() : U.gridClassLoader());
        } catch (GridException e) {
          f.onDone(null, new GridException("Failed to unmarshal response.", e));

          return;
        }
      }

      f.onDone(null, err);

      if (log.isDebugEnabled())
        log.debug(
            "Finished future [fut=" + f + ", reqId=" + res.requestId() + ", err=" + err + ']');
    }