本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.unmarshal方法的典型用法代码示例。如果您正苦于以下问题:Java U.unmarshal方法的具体用法?Java U.unmarshal怎么用?Java U.unmarshal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.unmarshal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreMetadata
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Restores metadata on startup of {@link CacheObjectBinaryProcessorImpl} but before starting discovery.
*/
void restoreMetadata() {
if (!CU.isPersistenceEnabled(ctx.config()))
return;
for (File file : workDir.listFiles()) {
try (FileInputStream in = new FileInputStream(file)) {
BinaryMetadata meta = U.unmarshal(ctx.config().getMarshaller(), in, U.resolveClassLoader(ctx.config()));
metadataLocCache.put(meta.typeId(), new BinaryMetadataHolder(meta, 0, 0));
}
catch (Exception e) {
U.warn(log, "Failed to restore metadata from file: " + file.getName() +
"; exception was thrown: " + e.getMessage());
}
}
}
示例2: unmarshall
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Unmarshalls transfer object from remote node within a given context.
*
* @param ctx Grid kernal context that provides deployment and marshalling services.
* @param sndNodeId {@link UUID} of the sender node.
* @param msg Transfer object that contains original serialized object and deployment information.
* @return Unmarshalled object.
* @throws IgniteCheckedException If node cannot obtain deployment.
*/
static Object unmarshall(GridKernalContext ctx, UUID sndNodeId, GridAffinityMessage msg)
throws IgniteCheckedException {
GridDeployment dep = ctx.deploy().getGlobalDeployment(
msg.deploymentMode(),
msg.sourceClassName(),
msg.sourceClassName(),
msg.userVersion(),
sndNodeId,
msg.classLoaderId(),
msg.loaderParticipants(),
null);
if (dep == null)
throw new IgniteDeploymentCheckedException("Failed to obtain affinity object (is peer class loading turned on?): " +
msg);
Object src = U.unmarshal(ctx, msg.source(),
U.resolveClassLoader(dep.classLoader(), ctx.config()));
// Resource injection.
ctx.resource().inject(dep, dep.deployedClass(msg.sourceClassName()), src);
return src;
}
示例3: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
Marshaller mrsh = ctx.marshaller();
if (keyValFilterBytes != null && keyValFilter == null)
keyValFilter = U.unmarshal(mrsh, keyValFilterBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
if (rdcBytes != null && rdc == null)
rdc = U.unmarshal(mrsh, rdcBytes, ldr);
if (transBytes != null && trans == null)
trans = U.unmarshal(mrsh, transBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
if (argsBytes != null && args == null)
args = U.unmarshal(mrsh, argsBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
示例4: deserialize
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public CacheEvent deserialize(String topic, byte[] bytes) {
try {
return U.unmarshal(marsh, bytes, getClass().getClassLoader());
}
catch (IgniteCheckedException e) {
throw new SerializationException("Failed to deserialize cache event!", e);
}
}
示例5: h2Serializer
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Serializer.
*/
private JavaObjectSerializer h2Serializer() {
return new JavaObjectSerializer() {
@Override public byte[] serialize(Object obj) throws Exception {
return U.marshal(marshaller, obj);
}
@Override public Object deserialize(byte[] bytes) throws Exception {
ClassLoader clsLdr = ctx != null ? U.resolveClassLoader(ctx.config()) : null;
return U.unmarshal(marshaller, bytes, clsLdr);
}
};
}
示例6: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
if (topicBytes != null && topic == null)
topic = U.unmarshal(ctx, topicBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
示例7: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
if (errBytes != null && err == null)
err = U.unmarshal(ctx, errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
示例8: unmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param marsh Marshaller.
* @return Unmarshalled payload.
* @throws IgniteCheckedException If failed.
*/
@Nullable public <T> T unmarshal(Marshaller marsh)
throws IgniteCheckedException {
if (bytes == null)
return null;
return U.unmarshal(marsh, bytes, null);
}
示例9: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(Marshaller marsh, @Nullable ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(marsh, ldr);
if (errBytes != null && err == null)
err = U.unmarshal(marsh, errBytes, ldr);
}
示例10: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
finishUnmarshalCacheObjects(vals, ctx.cacheContext(cacheId), ldr);
if (errBytes != null)
err = U.unmarshal(ctx, errBytes, U.resolveClassLoader(ldr, ctx.gridConfig()));
}
示例11: unmarshalSchemaError
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Unmarshal schema error.
*
* @param errBytes Error bytes.
* @return Error.
*/
@Nullable private SchemaOperationException unmarshalSchemaError(@Nullable byte[] errBytes) {
if (errBytes == null)
return null;
try {
return U.unmarshal(marsh, errBytes, U.resolveClassLoader(ctx.config()));
}
catch (Exception e) {
return new SchemaOperationException("Operation failed, but error cannot be deserialized.");
}
}
示例12: unmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public <T> T unmarshal(byte[] bytes) throws IOException {
try {
boolean unzip = bytes[0] > 0;
byte[] marshBytes = Arrays.copyOfRange(bytes, 1, bytes.length);
return U.unmarshal(opMarsh, unzip ? unzipBytes(marshBytes) : marshBytes, null);
}
catch (IgniteCheckedException e) {
throw new IOException(e);
}
}
示例13: beforeLocalExecution
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param ctx Context.
* @throws IgniteCheckedException In case of error.
*/
void beforeLocalExecution(GridCacheContext ctx) throws IgniteCheckedException {
Marshaller marsh = ctx.marshaller();
rdc = rdc != null ? U.<IgniteReducer<Object, Object>>unmarshal(marsh, U.marshal(marsh, rdc),
U.resolveClassLoader(ctx.gridConfig())) : null;
trans = trans != null ? U.<IgniteClosure<Object, Object>>unmarshal(marsh, U.marshal(marsh, trans),
U.resolveClassLoader(ctx.gridConfig())) : null;
}
示例14: localQueryInfo
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Query info.
* @throws IgniteCheckedException In case of error.
*/
private GridCacheQueryInfo localQueryInfo() throws IgniteCheckedException {
GridCacheQueryBean qry = query();
Marshaller marsh = cctx.marshaller();
IgniteReducer<Object, Object> rdc = qry.reducer() != null ?
U.<IgniteReducer<Object, Object>>unmarshal(marsh, U.marshal(marsh, qry.reducer()),
U.resolveClassLoader(cctx.gridConfig())) : null;
IgniteClosure<Object, Object> trans = qry.transform() != null ?
U.<IgniteClosure<Object, Object>>unmarshal(marsh, U.marshal(marsh, qry.transform()),
U.resolveClassLoader(cctx.gridConfig())) : null;
return new GridCacheQueryInfo(
true,
trans,
rdc,
qry.query(),
GridCacheLocalQueryFuture.this,
cctx.localNodeId(),
cctx.io().nextIoId(),
qry.query().includeMetadata(),
true,
qry.arguments()
);
}
示例15: onResponse
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param res Response.
* @param nodeId Node id.
*/
void onResponse(DataStreamerResponse res, UUID nodeId) {
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;
final Throwable cause = U.unmarshal(
ctx,
errBytes,
U.resolveClassLoader(jobPda0 != null ? jobPda0.classLoader() : null, ctx.config()));
final String msg = "DataStreamer request failed [node=" + nodeId + "]";
err = cause instanceof ClusterTopologyCheckedException ?
new ClusterTopologyCheckedException(msg, cause) :
new IgniteCheckedException(msg, cause);
}
catch (IgniteCheckedException e) {
f.onDone(null, new IgniteCheckedException("Failed to unmarshal response.", e));
return;
}
}
f.onDone(null, err);
if (log.isDebugEnabled())
log.debug("Finished future [fut=" + f + ", reqId=" + res.requestId() + ", err=" + err + ']');
}