Search in sources :

Example 1 with GridSerializableMap

use of org.apache.ignite.internal.util.GridSerializableMap in project ignite by apache.

the class GridCacheAdapter method warnIfUnordered.

/**
 * Checks that given map is sorted or otherwise constant order, or processed inside deadlock-detecting transaction.
 *
 * Issues developer warning otherwise.
 *
 * @param m Map to examine.
 */
protected void warnIfUnordered(Map<?, ?> m, BulkOperation op) {
    if (ctx.atomic())
        return;
    if (m == null || m.size() <= 1)
        return;
    if (m instanceof SortedMap || m instanceof GridSerializableMap)
        return;
    Transaction tx = ctx.kernalContext().cache().transactions().tx();
    if (tx != null && !op.canBlockTx(tx.concurrency(), tx.isolation()))
        return;
    LT.warn(log, "Unordered map " + m.getClass().getName() + " is used for " + op.title() + " operation on cache " + name() + ". " + "This can lead to a distributed deadlock. Switch to a sorted map like TreeMap instead.");
}
Also used : GridSerializableMap(org.apache.ignite.internal.util.GridSerializableMap) Transaction(org.apache.ignite.transactions.Transaction) SortedMap(java.util.SortedMap)

Aggregations

SortedMap (java.util.SortedMap)1 GridSerializableMap (org.apache.ignite.internal.util.GridSerializableMap)1 Transaction (org.apache.ignite.transactions.Transaction)1