/** * @return Cache deployment manager. */ public GridCacheDeploymentManager<K, V> deploy() { return sharedCtx.deploy(); }
/** * Enters a call. * * @param resume Flag to indicate that resume operation in progress. */ private void enter(boolean resume) { if (!resume && state() == SUSPENDED) throw new IgniteException("Tx in SUSPENDED state. All operations except resume are prohibited."); if (cctx.deploymentEnabled()) cctx.deploy().onEnter(); try { cctx.kernalContext().gateway().readLock(); } catch (IllegalStateException | IgniteClientDisconnectedException e) { throw e; } catch (RuntimeException | Error e) { cctx.kernalContext().gateway().readUnlock(); throw e; } }
/** * @param entries Entries. * @return First entry. * @throws IgniteCheckedException If failed. */ private IgniteTxEntry unmarshal(@Nullable Collection<IgniteTxEntry> entries) throws IgniteCheckedException { if (entries == null) return null; IgniteTxEntry firstEntry = null; for (IgniteTxEntry e : entries) { e.unmarshal(ctx, false, ctx.deploy().globalLoader()); if (firstEntry == null) firstEntry = e; } return firstEntry; }
/** * @param ctx Cache context. * @param depEnabled deployment enabled flag. * @param obj Object to marshal. * @return Buffer that contains obtained byte array. * @throws IgniteCheckedException If marshalling failed. */ public static byte[] marshal(GridCacheSharedContext ctx, boolean depEnabled, Object obj) throws IgniteCheckedException { assert ctx != null; if (depEnabled) { if (obj != null) { if (obj instanceof Iterable) ctx.deploy().registerClasses((Iterable<?>)obj); else if (obj.getClass().isArray()) { if (!U.isPrimitiveArray(obj)) ctx.deploy().registerClasses((Object[])obj); } else ctx.deploy().registerClass(obj); } } return U.marshal(ctx, obj); }
/** * @param o Object to prepare for marshalling. * @param ctx Context. * @throws IgniteCheckedException If failed. */ protected final void prepareObject(@Nullable Object o, GridCacheSharedContext ctx) throws IgniteCheckedException { assert addDepInfo || forceAddDepInfo; if (!skipPrepare && o != null) { GridDeploymentInfo d = ctx.deploy().globalDeploymentInfo(); if (d != null) { prepare(d); // Global deployment has been injected. skipPrepare = true; } else { Class<?> cls = U.detectClass(o); ctx.deploy().registerClass(cls); ClassLoader ldr = U.detectClassLoader(cls); if (ldr instanceof GridDeploymentInfo) prepare((GridDeploymentInfo)ldr); } } }
/** * Pre-processes message prior to send. * * @param msg Message to send. * @param destNodeId Destination node ID. * @return {@code True} if should send message. * @throws IgniteCheckedException If failed. */ private boolean onSend(GridCacheMessage msg, @Nullable UUID destNodeId) throws IgniteCheckedException { if (msg.error() != null && cctx.kernalContext().isStopping()) return false; if (msg.messageId() < 0) // Generate and set message ID. msg.messageId(idGen.incrementAndGet()); if (destNodeId == null || !cctx.localNodeId().equals(destNodeId)) { msg.prepareMarshal(cctx); if (msg instanceof GridCacheDeployable && msg.addDeploymentInfo()) cctx.deploy().prepare((GridCacheDeployable)msg); } return true; }
@Override public void onMessage(UUID nodeId, Object msg, byte plc) { if (msg instanceof TxLocksResponse) { try { ((TxLocksResponse)msg).finishUnmarshal(clientCtx, clientCtx.deploy().globalLoader()); res.set(true); } catch (Exception e) { log.error("Message unmarshal failed", e); } finally { latch.countDown(); } } } });
/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) throws IgniteCheckedException { CacheObjectValueContext valCtx = ctx.query().objectContext(); obj.finishUnmarshal(valCtx, ctx.cache().context().deploy().globalLoader()); return new GridH2ValueCacheObject(obj, valCtx); }
/** * @param nodeId Sender node ID. * @param cacheMsg Message. */ private void unmarshall(UUID nodeId, GridCacheMessage cacheMsg) { if (cctx.localNodeId().equals(nodeId)) return; try { cacheMsg.finishUnmarshal(cctx, cctx.deploy().globalLoader()); } catch (IgniteCheckedException e) { cacheMsg.onClassError(e); } catch (BinaryObjectException e) { cacheMsg.onClassError(new IgniteCheckedException(e)); } catch (Error e) { if (cacheMsg.ignoreClassErrors() && X.hasCause(e, NoClassDefFoundError.class, UnsupportedClassVersionError.class)) { cacheMsg.onClassError( new IgniteCheckedException("Failed to load class during unmarshalling: " + e, e) ); } else throw e; } } }
/** * @param info Entry to marshal. * @param ctx Context. * @param cacheObjCtx Cache object context. * @throws IgniteCheckedException If failed. */ protected final void marshalInfo(GridCacheEntryInfo info, GridCacheSharedContext ctx, CacheObjectContext cacheObjCtx ) throws IgniteCheckedException { assert ctx != null; if (info != null) { info.marshal(cacheObjCtx); if (addDepInfo) { if (info.key() != null) prepareObject(info.key().value(cacheObjCtx, false), ctx); CacheObject val = info.value(); if (val != null) { val.finishUnmarshal(cacheObjCtx, ctx.deploy().globalLoader()); prepareObject(val.value(cacheObjCtx, false), ctx); } } } }
"adding entry [msgId=" + msgId + ", e=" + e + ", tx=" + this + ']'; e.unmarshal(cctx, false, cctx.deploy().globalLoader());
nearTx = !F.isEmpty(req.nearWrites()) ? startNearRemoteTx(ctx.deploy().globalLoader(), nodeId, req) : null; dhtTx = startRemoteTx(nodeId, req, res);
tx.addWrite(entry, ctx.deploy().globalLoader());