コード例 #1
0
    /**
     * @return Query info.
     * @throws GridException In case of error.
     */
    @SuppressWarnings({"unchecked"})
    private GridCacheQueryInfo localQueryInfo() throws GridException {
      GridCacheQueryBean qry = query();

      GridPredicate<GridCacheEntry<Object, Object>> prjPred =
          qry.query().projectionFilter() == null
              ? F.<GridCacheEntry<Object, Object>>alwaysTrue()
              : qry.query().projectionFilter();

      GridMarshaller marsh = cctx.marshaller();

      GridReducer<Object, Object> rdc =
          qry.reducer() != null
              ? marsh.<GridReducer<Object, Object>>unmarshal(marsh.marshal(qry.reducer()), null)
              : null;

      GridClosure<Object, Object> trans =
          qry.transform() != null
              ? marsh.<GridClosure<Object, Object>>unmarshal(marsh.marshal(qry.transform()), null)
              : null;

      return new GridCacheQueryInfo(
          true,
          prjPred,
          trans,
          rdc,
          qry.query(),
          GridCacheLocalQueryFuture.this,
          ctx.localNodeId(),
          cctx.io().nextIoId(),
          qry.query().includeMetadata(),
          true,
          qry.arguments());
    }
コード例 #2
0
  /**
   * Deserialize object from byte array using marshaller.
   *
   * @param bytes Bytes to deserialize.
   * @param <X> Result object type.
   * @return Deserialized object.
   * @throws GridException If failed.
   */
  protected <X> X fromBytes(byte[] bytes) throws GridException {
    if (bytes == null || bytes.length == 0) return null;

    return marsh.unmarshal(bytes, getClass().getClassLoader());
  }
コード例 #3
0
 /**
  * Serialize object to byte array using marshaller.
  *
  * @param obj Object to convert to byte array.
  * @return Byte array.
  * @throws GridException If failed to convert.
  */
 protected byte[] toBytes(Object obj) throws GridException {
   return marsh.marshal(obj);
 }