Search in sources :

Example 6 with P2

use of org.apache.ignite.internal.util.typedef.P2 in project ignite by apache.

the class GridCommunicationManagerListenersSelfTest method testOneListener.

/**
     * This is the workaround- as long as we keep a message listener in
     * the stack, our FIFO bug isn't exposed.  Comment above out to see.
     */
@SuppressWarnings({ "deprecation" })
public void testOneListener() {
    Ignite ignite = G.ignite(getTestIgniteInstanceName());
    final AtomicBoolean stop = new AtomicBoolean();
    P2<UUID, Object> l = new P2<UUID, Object>() {

        @Override
        public boolean apply(UUID uuid, Object o) {
            return stop.get();
        }
    };
    try {
        ignite.message().localListen(null, l);
        checkLoop(2000);
    } finally {
        stop.set(true);
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) P2(org.apache.ignite.internal.util.typedef.P2) Ignite(org.apache.ignite.Ignite) UUID(java.util.UUID)

Aggregations

P2 (org.apache.ignite.internal.util.typedef.P2)6 UUID (java.util.UUID)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 Ignite (org.apache.ignite.Ignite)2 DiscoveryEvent (org.apache.ignite.events.DiscoveryEvent)2 Event (org.apache.ignite.events.Event)2 JobEvent (org.apache.ignite.events.JobEvent)2 P1 (org.apache.ignite.internal.util.typedef.P1)2 HashSet (java.util.HashSet)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Cache (javax.cache.Cache)1 CacheEntryEvent (javax.cache.event.CacheEntryEvent)1 IgniteCache (org.apache.ignite.IgniteCache)1 ContinuousQuery (org.apache.ignite.cache.query.ContinuousQuery)1 ClusterGroup (org.apache.ignite.cluster.ClusterGroup)1 GridConcurrentHashSet (org.apache.ignite.internal.util.GridConcurrentHashSet)1 PA (org.apache.ignite.internal.util.typedef.PA)1 ConcurrentHashMap8 (org.jsr166.ConcurrentHashMap8)1