当前位置: 首页>>代码示例>>Java>>正文


Java U.cast方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.cast方法的典型用法代码示例。如果您正苦于以下问题:Java U.cast方法的具体用法?Java U.cast怎么用?Java U.cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.typedef.internal.U的用法示例。


在下文中一共展示了U.cast方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAll

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Same as {@link GridFunc#isAll(Object, IgnitePredicate[])}, but safely unwraps exceptions.
 *
 * @param e Element.
 * @param p Predicates.
 * @param <E> Element type.
 * @return {@code True} if predicates passed.
 * @throws IgniteCheckedException If failed.
 */
@SuppressWarnings({"ErrorNotRethrown"})
public <E> boolean isAll(E e, @Nullable IgnitePredicate<? super E>[] p) throws IgniteCheckedException {
    if (F.isEmpty(p))
        return true;

    try {
        boolean pass = F.isAll(e, p);

        if (log.isDebugEnabled())
            log.debug("Evaluated filters for entry [pass=" + pass + ", entry=" + e + ", filters=" +
                Arrays.toString(p) + ']');

        return pass;
    }
    catch (RuntimeException ex) {
        throw U.cast(ex);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:GridCacheContext.java

示例2: sessionEnd0

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Clears session holder.
 */
private void sessionEnd0(@Nullable IgniteInternalTx tx, boolean threwEx) throws IgniteCheckedException {
    try {
        if (tx == null) {
            if (sesLsnrs != null && sesHolder.get().contains(store)) {
                for (CacheStoreSessionListener lsnr : sesLsnrs)
                    lsnr.onSessionEnd(locSes, !threwEx);
            }

            if (!sesHolder.get().ended(store))
                store.sessionEnd(!threwEx);
        }
    }
    catch (Exception e) {
        if (!threwEx)
            throw U.cast(e);
    }
    finally {
        if (sesHolder != null)
            sesHolder.set(null);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:GridCacheStoreManagerAdapter.java

示例3: callLocalSafe

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Companion to {@link #callLocal(Callable, boolean)} but in case of rejected execution re-runs
 * the closure in the current thread (blocking).
 *
 * @param c Closure to execute.
 * @param plc Policy to choose executor pool.
 * @return Future.
 */
public  <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c, byte plc) {
    try {
        return callLocal(c, plc);
    }
    catch (IgniteCheckedException e) {
        // If execution was rejected - rerun locally.
        if (e.getCause() instanceof RejectedExecutionException) {
            U.warn(log, "Closure execution has been rejected (will execute in the same thread) [plc=" + plc +
                ", closure=" + c + ']');

            try {
                return new GridFinishedFuture<>(c.call());
            }
            // If failed again locally - return error future.
            catch (Exception e2) {
                return new GridFinishedFuture<>(U.cast(e2));
            }
        }
        // If failed for other reasons - return error future.
        else
            return new GridFinishedFuture<>(U.cast(e));
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:32,代码来源:GridClosureProcessor.java

示例4: reserveSpace

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Reserve space for file.
 *
 * @param fileId File ID.
 * @param space Space.
 * @param affRange Affinity range.
 * @return New file info.
 */
public IgfsEntryInfo reserveSpace(IgniteUuid fileId, long space, IgfsFileAffinityRange affRange)
    throws IgniteCheckedException {
    validTxState(false);

    if (busyLock.enterBusy()) {
        try {
            if (log.isDebugEnabled())
                log.debug("Reserve file space: " + fileId);

            try (GridNearTxLocal tx = startTx()) {
                // Lock file ID for this transaction.
                IgfsEntryInfo oldInfo = info(fileId);

                if (oldInfo == null)
                    throw fsException("File has been deleted concurrently: " + fileId);

                IgfsEntryInfo newInfo =
                    invokeAndGet(fileId, new IgfsMetaFileReserveSpaceProcessor(space, affRange));

                tx.commit();

                return newInfo;
            }
            catch (GridClosureException e) {
                throw U.cast(e);
            }
        }
        finally {
            busyLock.leaveBusy();
        }
    }
    else
        throw new IllegalStateException("Failed to reserve file space because Grid is stopping:" + fileId);
}
 
开发者ID:apache,项目名称:ignite,代码行数:43,代码来源:IgfsMetaManager.java

示例5: validateKeyAndValue

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Performs validation of provided key and value against configured constraints.
 *
 * @param key Key.
 * @param val Value.
 * @throws IgniteCheckedException, If validation fails.
 */
public void validateKeyAndValue(KeyCacheObject key, CacheObject val) throws IgniteCheckedException {
    if (!isQueryEnabled())
        return;

    try {
        ctx.query().validateKeyAndValue(cacheObjCtx, key, val);
    }
    catch (RuntimeException e) {
        throw U.cast(e);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:GridCacheContext.java

示例6: runLocalSafe

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * In case of rejected execution re-runs the closure in the current thread (blocking).
 *
 * @param c Closure to execute.
 * @param plc Policy to choose executor pool.
 * @return Future.
 */
public IgniteInternalFuture<?> runLocalSafe(Runnable c, byte plc) {
    try {
        return runLocal(c, plc);
    }
    catch (Throwable e) {
        if (e instanceof Error) {
            U.error(log, "Closure execution failed with error.", e);

            throw (Error)e;
        }

        // If execution was rejected - rerun locally.
        if (e.getCause() instanceof RejectedExecutionException) {
            U.warn(log, "Closure execution has been rejected (will execute in the same thread) [plc=" + plc +
                ", closure=" + c + ']');

            try {
                c.run();

                return new GridFinishedFuture();
            }
            catch (Throwable t) {
                if (t instanceof Error) {
                    U.error(log, "Closure execution failed with error.", t);

                    throw t;
                }

                return new GridFinishedFuture(U.cast(t));
            }
        }
        // If failed for other reasons - return error future.
        else
            return new GridFinishedFuture(U.cast(e));
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:44,代码来源:GridClosureProcessor.java

示例7: get

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public T get() throws IgniteCheckedException {
    if (resFlag == ERR)
        throw U.cast((Throwable)res);

    return (T)res;
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridFinishedFuture.java

示例8: resolve

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Resolves the value to result or exception.
 *
 * @return Result.
 * @throws IgniteCheckedException If resolved to exception.
 */
@SuppressWarnings("unchecked")
private R resolve() throws IgniteCheckedException {
    if(state == CANCELLED)
        throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this);

    if(state == null || state.getClass() != ErrorWrapper.class)
        return (R)state;

    throw U.cast(((ErrorWrapper)state).error);
}
 
开发者ID:apache,项目名称:ignite,代码行数:17,代码来源:GridFutureAdapter.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.cast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。