Search in sources :

Example 1 with PlatformProcessor

use of org.apache.ignite.internal.processors.platform.PlatformProcessor in project ignite by apache.

the class GridCacheMapEntry method updatePlatformCache.

/**
 * Invokes platform cache update callback, if applicable.
 *
 * @param val Updated value, null on remove.
 * @param ver Topology version, null on remove.
 */
protected void updatePlatformCache(@Nullable CacheObject val, @Nullable AffinityTopologyVersion ver) {
    if (!hasPlatformCache())
        return;
    PlatformProcessor proc = this.cctx.kernalContext().platform();
    if (!proc.hasContext() || !proc.context().isPlatformCacheSupported())
        return;
    try {
        CacheObjectContext ctx = this.cctx.cacheObjectContext();
        // val is null when entry is removed.
        byte[] keyBytes = this.key.valueBytes(ctx);
        byte[] valBytes = val == null ? null : val.valueBytes(ctx);
        proc.context().updatePlatformCache(this.cctx.cacheId(), keyBytes, valBytes, partition(), ver);
    } catch (Throwable e) {
        U.error(log, "Failed to update Platform Cache: " + e);
    }
}
Also used : PlatformProcessor(org.apache.ignite.internal.processors.platform.PlatformProcessor)

Example 2 with PlatformProcessor

use of org.apache.ignite.internal.processors.platform.PlatformProcessor in project ignite by apache.

the class PlatformAbstractJob method execute.

/**
 * {@inheritDoc}
 */
@Nullable
@Override
public Object execute() {
    try {
        PlatformProcessor interopProc = PlatformUtils.platformProcessor(ignite);
        interopProc.awaitStart();
        return execute0(interopProc.context());
    } catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) PlatformProcessor(org.apache.ignite.internal.processors.platform.PlatformProcessor) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with PlatformProcessor

use of org.apache.ignite.internal.processors.platform.PlatformProcessor in project ignite by apache.

the class PlatformCacheEntryProcessorImpl method process.

/**
 * {@inheritDoc}
 */
@Override
public Object process(MutableEntry entry, Object... args) throws EntryProcessorException {
    try {
        Ignite ignite = (Ignite) entry.unwrap(Ignite.class);
        PlatformProcessor interopProc;
        try {
            interopProc = PlatformUtils.platformProcessor(ignite);
        } catch (IllegalStateException ex) {
            throw new EntryProcessorException(ex);
        }
        interopProc.awaitStart();
        return execute0(interopProc.context(), entry);
    } catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) PlatformProcessor(org.apache.ignite.internal.processors.platform.PlatformProcessor) EntryProcessorException(javax.cache.processor.EntryProcessorException) Ignite(org.apache.ignite.Ignite)

Example 4 with PlatformProcessor

use of org.apache.ignite.internal.processors.platform.PlatformProcessor in project ignite by apache.

the class CacheOsStoreManager method start0.

/**
 * {@inheritDoc}
 */
@Override
protected void start0() throws IgniteCheckedException {
    if (configured()) {
        CacheStore store = configuredStore();
        assert store != null;
        assert !(store instanceof GridCacheWriteBehindStore);
        if (store instanceof PlatformCacheStore) {
            PlatformProcessor proc = ctx.platform();
            proc.registerStore((PlatformCacheStore) store, configuredConvertBinary());
        }
    }
    super.start0();
}
Also used : PlatformCacheStore(org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore) PlatformProcessor(org.apache.ignite.internal.processors.platform.PlatformProcessor) PlatformCacheStore(org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore) CacheStore(org.apache.ignite.cache.store.CacheStore)

Example 5 with PlatformProcessor

use of org.apache.ignite.internal.processors.platform.PlatformProcessor in project ignite by apache.

the class GridQueryProcessor method registerPlatformTypeLocally.

/**
 * Registers platform type locally.
 *
 * @param clsName Class name.
 * @param binProc Binary processor.
 */
private void registerPlatformTypeLocally(String clsName, CacheObjectBinaryProcessorImpl binProc) {
    PlatformProcessor platformProc = ctx.platform();
    if (platformProc == null || !platformProc.hasContext())
        return;
    PlatformContext platformCtx = platformProc.context();
    BinaryMetadata meta = platformCtx.getBinaryType(clsName);
    if (meta != null)
        binProc.binaryContext().registerClassLocally(meta.wrap(binProc.binaryContext()), false, platformCtx.getMarshallerPlatformId());
}
Also used : PlatformProcessor(org.apache.ignite.internal.processors.platform.PlatformProcessor) PlatformContext(org.apache.ignite.internal.processors.platform.PlatformContext) BinaryMetadata(org.apache.ignite.internal.binary.BinaryMetadata)

Aggregations

PlatformProcessor (org.apache.ignite.internal.processors.platform.PlatformProcessor)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 EntryProcessorException (javax.cache.processor.EntryProcessorException)1 Ignite (org.apache.ignite.Ignite)1 CacheStore (org.apache.ignite.cache.store.CacheStore)1 BinaryMetadata (org.apache.ignite.internal.binary.BinaryMetadata)1 PlatformContext (org.apache.ignite.internal.processors.platform.PlatformContext)1 PlatformCacheStore (org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore)1 Nullable (org.jetbrains.annotations.Nullable)1