Search in sources :

Example 1 with Order

use of org.apache.ignite.internal.managers.systemview.walker.Order in project gridgain by gridgain.

the class ComputeJobView method affinityCacheIds.

/**
 * @return Comma separated list of cache identifiers or {@code null} for non affinity call.
 */
@Order(5)
public String affinityCacheIds() {
    GridReservable res = job.getPartsReservation();
    if (!(res instanceof GridJobProcessor.PartitionsReservation))
        return null;
    int[] ids = ((GridJobProcessor.PartitionsReservation) res).getCacheIds();
    if (ids == null || ids.length == 0)
        return null;
    StringJoiner joiner = new StringJoiner(",");
    for (int id : ids) joiner.add(Integer.toString(id));
    return joiner.toString();
}
Also used : GridReservable(org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable) StringJoiner(java.util.StringJoiner) Order(org.apache.ignite.internal.managers.systemview.walker.Order)

Example 2 with Order

use of org.apache.ignite.internal.managers.systemview.walker.Order in project ignite by apache.

the class ComputeJobView method affinityCacheIds.

/**
 * @return Comma separated list of cache identifiers or {@code null} for non affinity call.
 */
@Order(5)
public String affinityCacheIds() {
    GridReservable res = job.getPartsReservation();
    if (!(res instanceof GridJobProcessor.PartitionsReservation))
        return null;
    int[] ids = ((GridJobProcessor.PartitionsReservation) res).getCacheIds();
    if (ids == null || ids.length == 0)
        return null;
    StringJoiner joiner = new StringJoiner(",");
    for (int id : ids) joiner.add(Integer.toString(id));
    return joiner.toString();
}
Also used : GridReservable(org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable) StringJoiner(java.util.StringJoiner) Order(org.apache.ignite.internal.managers.systemview.walker.Order)

Example 3 with Order

use of org.apache.ignite.internal.managers.systemview.walker.Order in project ignite by apache.

the class TransactionView method cacheIds.

/**
 * @return Id of the cashes participating in transaction.
 * @see IgniteTxState#cacheIds()
 */
@Order(8)
public String cacheIds() {
    GridIntList cacheIds = tx.txState().cacheIds();
    if (cacheIds == null)
        return null;
    int sz = cacheIds.size();
    if (sz == 0)
        return null;
    // GridIntList is not synchronized. If we fail while iterating just ignore.
    try {
        SB b = new SB();
        for (int i = 0; i < sz; i++) {
            if (i != 0)
                b.a(',');
            b.a(cacheIds.get(i));
        }
        return b.toString();
    } catch (Throwable e) {
        return null;
    }
}
Also used : GridIntList(org.apache.ignite.internal.util.GridIntList) SB(org.apache.ignite.internal.util.typedef.internal.SB) Order(org.apache.ignite.internal.managers.systemview.walker.Order)

Example 4 with Order

use of org.apache.ignite.internal.managers.systemview.walker.Order in project gridgain by gridgain.

the class TransactionView method cacheIds.

/**
 * @return Id of the cashes participating in transaction.
 * @see IgniteTxState#cacheIds()
 */
@Order(8)
public String cacheIds() {
    GridIntList cacheIds = tx.txState().cacheIds();
    if (cacheIds == null)
        return null;
    int sz = cacheIds.size();
    if (sz == 0)
        return null;
    // GridIntList is not synchronized. If we fail while iterating just ignore.
    try {
        SB b = new SB();
        for (int i = 0; i < sz; i++) {
            if (i != 0)
                b.a(',');
            b.a(cacheIds.get(i));
        }
        return b.toString();
    } catch (Throwable e) {
        return null;
    }
}
Also used : GridIntList(org.apache.ignite.internal.util.GridIntList) SB(org.apache.ignite.internal.util.typedef.internal.SB) Order(org.apache.ignite.internal.managers.systemview.walker.Order)

Aggregations

Order (org.apache.ignite.internal.managers.systemview.walker.Order)4 StringJoiner (java.util.StringJoiner)2 GridReservable (org.apache.ignite.internal.processors.cache.distributed.dht.GridReservable)2 GridIntList (org.apache.ignite.internal.util.GridIntList)2 SB (org.apache.ignite.internal.util.typedef.internal.SB)2