Example usage for java.util.concurrent ConcurrentSkipListMap ConcurrentSkipListMap

List of usage examples for java.util.concurrent ConcurrentSkipListMap ConcurrentSkipListMap

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListMap ConcurrentSkipListMap.

Prototype

public ConcurrentSkipListMap() 

Source Link

Document

Constructs a new, empty map, sorted according to the Comparable natural ordering of the keys.

Usage

From source file:org.apache.hadoop.hbase.ZKNamespaceManager.java

public ZKNamespaceManager(ZooKeeperWatcher zkw) throws IOException {
    super(zkw);/*from   w ww .  j a v  a  2s  . c o  m*/
    nsZNode = ZooKeeperWatcher.namespaceZNode;
    cache = new ConcurrentSkipListMap<String, NamespaceDescriptor>();
}

From source file:org.apache.bookkeeper.mledger.util.RangeCache.java

/**
 * Construct a new RangeLruCache.//  w  w w  .j a v a  2 s  .co  m
 *
 * @param weighter
 *            a custom weighter to compute the size of each stored value
 */
public RangeCache(Weighter<Value> weighter) {
    this.size = new AtomicLong(0);
    this.entries = new ConcurrentSkipListMap<>();
    this.weighter = weighter;
}

From source file:org.xenmaster.monitoring.MonitoringAgent.java

private MonitoringAgent() {
    vmData = ArrayListMultimap.create();
    hostData = ArrayListMultimap.create();
    data = new ConcurrentSkipListMap<>();
    NTPUDPClient nuc = new NTPUDPClient();
    ringBuffer = new RingBuffer<>(Record.EVENT_FACTORY, new SingleThreadedClaimStrategy(RING_SIZE),
            new BlockingWaitStrategy());
    eventHandler = new EventHandler();
    comptroller = new Comptroller();
    emitter = new Emitter();
    collector = new Collector();
    correl = new Correlator();

    setUpEngine();//from  ww w  .j a v a2 s.  c  o m

    try {
        timeInfo = nuc.getTime(InetAddress.getByName(NTP_SERVER));
        timeInfo.computeDetails();
        Logger.getLogger(getClass())
                .info("Current time "
                        + new DateTime(System.currentTimeMillis() + timeInfo.getOffset())
                                .toString("dd/MM/yyyy HH:mm:ss.S")
                        + ". Clock drift " + timeInfo.getOffset() + " milliseconds");
    } catch (IOException ex) {
        Logger.getLogger(getClass()).warn("NTP time retrieval failed", ex);
    }
}

From source file:org.wso2.andes.server.slot.SlotDeliveryWorker.java

public SlotDeliveryWorker() {
    messageFlusher = MessageFlusher.getInstance();
    this.storageQueueNameToDestinationMap = new ConcurrentSkipListMap<String, String>();
    this.subscriptionStore = AndesContext.getInstance().getSubscriptionStore();
    isClusteringEnabled = AndesContext.getInstance().isClusteringEnabled();
    localLastProcessedIdMap = new HashMap<String, Long>();
    /*/* ww w  . j  a v a  2  s .c  o m*/
    Start slot deleting thread only if clustering is enabled. Otherwise slots assignment will
     not happen
     */
    if (isClusteringEnabled) {
        nodeId = HazelcastAgent.getInstance().getNodeId();
    }
}

From source file:org.loklak.objects.Timeline.java

public Timeline(Order order) {
    this.tweets = new ConcurrentSkipListMap<String, MessageEntry>();
    this.users = new ConcurrentHashMap<String, UserEntry>();
    this.order = order;
    this.query = null;
    this.indexName = null;
}

From source file:org.wso2.andes.kernel.slot.SlotDeliveryWorker.java

public SlotDeliveryWorker() {
    messageFlusher = MessageFlusher.getInstance();
    this.storageQueueNameToDestinationMap = new ConcurrentSkipListMap<String, String>();
    this.subscriptionStore = AndesContext.getInstance().getSubscriptionStore();
    isClusteringEnabled = AndesContext.getInstance().isClusteringEnabled();
    localLastProcessedIdMap = new HashMap<String, Long>();
    slotDeletionScheduler = new SlotDeletionScheduler(SLOT_DELETION_SCHEDULE_INTERVAL);
    /*//from w ww .  j av  a  2  s  .  c o m
    Start slot deleting thread only if clustering is enabled. Otherwise slots assignment will
     not happen
     */
    if (isClusteringEnabled) {
        nodeId = HazelcastAgent.getInstance().getNodeId();
    }
}

From source file:annis.gui.flatquerybuilder.ValueField.java

public ValueField(FlatQueryBuilder sq, SearchBox sb, String level) {
    /*INIT VALUES*/
    this.sq = sq;
    this.sb = sb;
    this.level = level;
    vm = (sb.isRegEx()) ? ValueMode.REGEX : ValueMode.NORMAL;
    values = new ConcurrentSkipListMap<>();
    for (String v : sq.getAvailableAnnotationLevels(level)) {
        values.put(v, sq.escapeRegexCharacters(v));
    }//from www .  jav  a 2s . c  om

    /*SENSITIVE COMBOBOX*/
    scb = new SensitiveComboBox();
    scb.setImmediate(true);
    scb.setNewItemsAllowed(true);
    scb.setTextInputAllowed(true);
    scb.setFilteringMode(FilteringMode.OFF);
    scb.addListener((TextChangeListener) this);
    scb.setItemCaptionMode(ItemCaptionMode.ID);
    buildValues(vm);
    scb.addStyleName(SCB_STYLE_NAME);
    scb.setWidth(SCB_WIDTH);

    /*BUTTON*/
    bt = new Button(BUTTON_LABEL_REMOVE);
    bt.addClickListener((Button.ClickListener) this);
    bt.setStyleName(ChameleonTheme.BUTTON_SMALL);

    /*HORIZONTAL LAYOUT*/
    frame = new HorizontalLayout();
    frame.setSpacing(true);//used to be true    
    frame.setCaption(level);

    /*VISUALIZE*/
    frame.addComponent(scb);
    frame.addComponent(bt);
    frame.setComponentAlignment(bt, Alignment.BOTTOM_RIGHT);
    setContent(frame);
}

From source file:ai.susi.server.AccessTracker.java

public AccessTracker(File dump_dir, String dump_file_prefix, long track_timeout, long schedule_period)
        throws IOException {
    this.history = new JsonRepository(dump_dir, dump_file_prefix, null, JsonRepository.Mode.COMPRESSED, false,
            1);//www  .  j a v a2s .  c o  m
    this.track_timeout = track_timeout;
    this.schedule_period = schedule_period;
    this.terminate = false;
    this.pendingQueue = new ConcurrentSkipListMap<>();
    this.finishedQueue = new ConcurrentSkipListMap<>();
}

From source file:voldemort.store.cachestore.impl.SortedCacheStore.java

/**
 *
 * @param path/*from   w  ww  . j a v a 2s . c  om*/
 * @param blockSize
 * @param curIndex
 * @param filename
 * @param delayWrite
 * @param mode
 */
public SortedCacheStore(String path, BlockSize blockSize, int curIndex, String filename, boolean delayWrite,
        int mode) {
    this.delayWrite = delayWrite;
    if (delayWrite) {
        delayWriteQueue = new LinkedBlockingQueue<DelayBlock>(QUEUE_SIZE);
    }
    this.mode = mode;
    checkPath(path);
    this.path = path;
    this.blockSize = blockSize;
    this.curIndex = curIndex;
    this.overflow = new AtomicLong(0);
    this.list = new CopyOnWriteArrayList<ChannelStore>();
    this.namePrefix = filename;
    this.map = new ConcurrentSkipListMap<Key, CacheBlock>();
    //check to see if more file 0 / 1
    if (curIndex <= 1) {
        list.add(0, open(getPath(path) + filename + curIndex, map, false, 0, delayWrite, mode));
        deleted += list.get(0).getDeleted();
        if (ChannelStore.isChannelExist(getPath(path) + filename + 1 + ".ndx")) {
            // close channel 0
            list.get(0).close(delayWriteQueue);
            list.add(1, open(getPath(path) + filename + 1, map, false, 1, delayWrite, mode));
            this.curIndex = 1;
            deleted += list.get(1).getDeleted();
        }
    } else {
        throw new StoreException("not support for index " + curIndex + " > 1 ");
    }
    initMetaDataStore();
    serverState = State.Active;
}

From source file:com.microsoft.wake.contrib.grouper.impl.AppendingSnowshovelGrouper.java

@Inject
public AppendingSnowshovelGrouper(Combiner<OutType, K, List<V>> c, Partitioner<K> p,
        Extractor<InType, K, V> ext,
        @Parameter(StageConfiguration.StageObserver.class) Observer<Tuple<Integer, OutType>> o,
        @Parameter(StageConfiguration.NumberOfThreads.class) int outputThreads,
        @Parameter(StageConfiguration.StageName.class) String stageName,
        @Parameter(ContinuousStage.PeriodNS.class) long outputPeriod_ns) {
    super(stageName);
    this.c = c;//  w  ww. j  a v  a2 s.  com
    this.p = p;
    this.ext = ext;
    this.o = o;
    // calling this.new on a @Unit's inner class without its own state is currently the same as Tang injecting it
    this.outputDriver = new ContinuousStage<Object>(this.new OutputImpl(), outputThreads, stageName + "-out",
            outputPeriod_ns);
    this.doneHandler = ((ContinuousStage<Object>) outputDriver).getDoneHandler();
    register = new ConcurrentSkipListMap<>();
    inputDone = false;
    this.inputObserver = this.new InputImpl();

    this.sleeping = new AtomicInteger();

    // there is no dependence from input finish to output start
    // The alternative placement of this event is in the first call to onNext,
    // but Output onNext already provides blocking
    outputDriver.onNext(new GrouperEvent());
}