Search in sources :

Example 11 with LinkedMap

use of org.apache.commons.collections.map.LinkedMap in project jackrabbit by apache.

the class LockManagerImpl method consolidateEvents.

/**
     * Consolidate an event iterator obtained from observation, merging
     * add and remove operations on nodes with the same UUID into a move
     * operation.
     */
@SuppressWarnings("unchecked")
private Iterator<HierarchyEvent> consolidateEvents(EventIterator events) {
    LinkedMap eventMap = new LinkedMap();
    while (events.hasNext()) {
        EventImpl event = (EventImpl) events.nextEvent();
        HierarchyEvent he;
        try {
            he = new HierarchyEvent(event.getChildId(), sysSession.getQPath(event.getPath()).getNormalizedPath(), event.getType());
        } catch (MalformedPathException e) {
            log.info("Unable to get event's path: " + e.getMessage());
            continue;
        } catch (RepositoryException e) {
            log.info("Unable to get event's path: " + e.getMessage());
            continue;
        }
        HierarchyEvent heExisting = (HierarchyEvent) eventMap.get(he.id);
        if (heExisting != null) {
            heExisting.merge(he);
        } else {
            eventMap.put(he.id, he);
        }
    }
    return eventMap.values().iterator();
}
Also used : EventImpl(org.apache.jackrabbit.core.observation.EventImpl) MalformedPathException(org.apache.jackrabbit.spi.commons.conversion.MalformedPathException) RepositoryException(javax.jcr.RepositoryException) LinkedMap(org.apache.commons.collections.map.LinkedMap)

Aggregations

LinkedMap (org.apache.commons.collections.map.LinkedMap)11 Test (org.junit.Test)8 OperatorStateStore (org.apache.flink.api.common.state.OperatorStateStore)6 Serializable (java.io.Serializable)5 StateInitializationContext (org.apache.flink.runtime.state.StateInitializationContext)5 StateSnapshotContextSynchronousImpl (org.apache.flink.runtime.state.StateSnapshotContextSynchronousImpl)5 Configuration (org.apache.flink.configuration.Configuration)4 KafkaTopicPartition (org.apache.flink.streaming.connectors.kafka.internals.KafkaTopicPartition)4 HashMap (java.util.HashMap)3 ListStateDescriptor (org.apache.flink.api.common.state.ListStateDescriptor)3 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)3 CacheVisitor (org.apache.hadoop.hdfs.shortcircuit.ShortCircuitCache.CacheVisitor)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 MutableBoolean (org.apache.commons.lang.mutable.MutableBoolean)2 StreamingRuntimeContext (org.apache.flink.streaming.api.operators.StreamingRuntimeContext)2 DistributedFileSystem (org.apache.hadoop.hdfs.DistributedFileSystem)2 ExtendedBlockId (org.apache.hadoop.hdfs.ExtendedBlockId)2 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)2 ExtendedBlock (org.apache.hadoop.hdfs.protocol.ExtendedBlock)2