Create a copy of TokenMetadata with tokenToEndpointMap reflecting situation after all
current leave, and move operations have finished.

@return new token metadata
2044
public TokenMetadata cloneAfterAllSettled()
    {
        lock.readLock().lock();

        try
        {
            TokenMetadata metadata = cloneOnlyTokenMap();

            for (InetAddress endpoint : leavingEndpoints)
                metadata.removeEndpoint(endpoint);


            for (Pair<Token, InetAddress> pair : movingEndpoints)
                metadata.updateNormalToken(pair.left, pair.right);

            return metadata;
        }
        finally
        {
            lock.readLock().unlock();
        }
    }
908351
@Override
    public void endMetaData(MetaData metadata)
    {
        this.builder.addBlock(new MetaDataBlock(this.builder.endBlockList(), metadata));
    }
755168
@Override
    public Object createExample() {
        AnnotationDto result = new AnnotationDto();
        Map<String, String> sampleFields = new HashMap<>();

        fields.put("fieldName", "fieldValue");
        result.setFields(sampleFields);
        result.setId("datasourceSpecificUniqueID");
        result.setMetric("metric");
        result.setScope("scope");
        result.setSource("splunk");

        Map<String, String> sampleTags = new HashMap<>();

        sampleTags.put("tagk", "tagv");
        result.setTags(sampleTags);
        result.setTimestamp(System.currentTimeMillis());
        result.setType("erelease");
        return result;
    }
556157
public CmsSitemapClipboardData copy() {

        LinkedHashMap<CmsUUID, CmsClientSitemapEntry> deletions = new LinkedHashMap<CmsUUID, CmsClientSitemapEntry>();
        deletions.putAll(m_deletions);
        LinkedHashMap<CmsUUID, CmsClientSitemapEntry> modifications = new LinkedHashMap<CmsUUID, CmsClientSitemapEntry>();
        modifications.putAll(m_modifications);
        return new CmsSitemapClipboardData(deletions, modifications);
    }
518237
public static HashMap<String, Object> makeEmptyFrameMeta() {
    HashMap<String,Object> hm = new LinkedHashMap<>(); // preserve insertion order
    for(String key: FrameMetadata.METAVALUES) hm.put(key,null);
    return hm;
  }
1065347
@Override
	public TemporaryTopic createTemporaryTopic() throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        String topicName = "TEMP-TOPIC-"+UUIDProvider.getInstance().getShortUUID();
	        engine.createTemporaryTopic(topicName);
	        connection.registerTemporaryTopic(topicName);
	        
	        return new TemporaryTopicRef(connection,topicName);
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
912674
public Map<String, TemplateTokenInfo> getTokensAsMap() {
        HashMap<String, TemplateTokenInfo> tokens = new HashMap<String, TemplateTokenInfo>();
        for (TemplateTokenInfo tokenInfo : tokenInfos)
            tokens.put(tokenInfo.getName(), tokenInfo);
        return Collections.unmodifiableMap(tokens);
    }
212382
public ElasticHashinator addTokens(NavigableMap<Integer, Integer> tokensToAdd)
    {
        // figure out the interval
        long interval = deriveTokenInterval(m_tokensMap.get().keySet());

        Map<Integer, Integer> tokens = Maps.newTreeMap();
        for (Map.Entry<Integer, Integer> e : m_tokensMap.get().entrySet()) {
            if (tokensToAdd.containsKey(e.getKey())) {
                continue;
            }

            // see if we are moving an intermediate token forward
            if (isIntermediateToken(e.getKey(), interval)) {
                Map.Entry<Integer, Integer> floorEntry = tokensToAdd.floorEntry(e.getKey());
                // If the two tokens belong to the same partition and bucket, we are moving the one on the ring
                // forward, so remove it from the ring
                if (floorEntry != null &&
                    floorEntry.getValue().equals(e.getValue()) &&
                    containingBucket(floorEntry.getKey(), interval) == containingBucket(e.getKey(), interval)) {
                    continue;
                }
            }

            tokens.put(e.getKey(), e.getValue());
        }
        tokens.putAll(tokensToAdd);

        return new ElasticHashinator(ImmutableSortedMap.copyOf(tokens));
    }
1161909
public Map<String, Object> snapshotTracingData() {

        Map<String, Object> traceMap = new LinkedHashMap<>();
        traceMap.put("version", 1L);
        traceMap.put("startTime", rfc3339(startRequestTime));
        traceMap.put("endTime", rfc3339(Instant.now()));
        traceMap.put("duration", System.nanoTime() - startRequestNanos);
        traceMap.put("parsing", copyMap(parseMap));
        traceMap.put("validation", copyMap(validationMap));
        traceMap.put("execution", executionData());

        return traceMap;
    }
239206
public void addMovingEndpoint(Token token, InetAddress endpoint)
    {
        assert endpoint != null;

        lock.writeLock().lock();

        try
        {
            movingEndpoints.add(Pair.create(token, endpoint));
        }
        finally
        {
            lock.writeLock().unlock();
        }
    }
417610
private ITag createFileMeta() {
        log.debug("createFileMeta");
        // create tag for onMetaData event
        IoBuffer in = IoBuffer.allocate(1024);
        in.setAutoExpand(true);
        Output out = new Output(in);
        out.writeString("onMetaData");
        Map<Object, Object> props = new HashMap<Object, Object>();
        props.put("audiocodecid", IoConstants.FLAG_FORMAT_MP3);
        props.put("canSeekToEnd", true);
        // set id3 meta data if it exists
        if (metaData != null) {
            if (metaData.artist != null) {
                props.put("artist", metaData.artist);
            }
            if (metaData.album != null) {
                props.put("album", metaData.album);
            }
            if (metaData.songName != null) {
                props.put("songName", metaData.songName);
            }
            if (metaData.genre != null) {
                props.put("genre", metaData.genre);
            }
            if (metaData.year != null) {
                props.put("year", metaData.year);
            }
            if (metaData.track != null) {
                props.put("track", metaData.track);
            }
            if (metaData.comment != null) {
                props.put("comment", metaData.comment);
            }
            if (metaData.duration != null) {
                props.put("duration", metaData.duration);
            }
            if (metaData.channels != null) {
                props.put("channels", metaData.channels);
            }
            if (metaData.sampleRate != null) {
                props.put("samplerate", metaData.sampleRate);
            }
            if (metaData.hasCoverImage()) {
                Map<Object, Object> covr = new HashMap<>(1);
                covr.put("covr", new Object[] { metaData.getCovr() });
                props.put("tags", covr);
            }
            //clear meta for gc
            metaData = null;
        }
        log.debug("Metadata properties map: {}", props);
        // check for duration
        if (!props.containsKey("duration")) {
            // generate it from framemeta
            if (frameMeta != null) {
                props.put("duration", frameMeta.timestamps[frameMeta.timestamps.length - 1] / 1000.0);
            } else {
                log.debug("Frame meta was null");
            }
        }
        // set datarate
        if (dataRate > 0) {
            props.put("audiodatarate", dataRate);
        }
        out.writeMap(props);
        in.flip();
        // meta-data
        ITag result = new Tag(IoConstants.TYPE_METADATA, 0, in.limit(), null, prevSize);
        result.setBody(in);
        return result;
    }
2617
private UpdateableSegmentMetadata createSegmentMetadata(String segmentName, long segmentId) {
        UpdateableSegmentMetadata metadata = new StreamSegmentMetadata(segmentName, segmentId, this.containerId);
        this.newSegments.put(metadata.getId(), metadata);
        this.newSegmentNames.put(metadata.getName(), metadata.getId());
        return metadata;
    }
1051296
@JsonProperty
    private Map<String, Object> getMetadata() {
        if (metadata == null) {
            metadata = new HashMap<>();
        }
        
        return metadata;
    }
1360081
public Notify getMetaData() {
        Notify md = metaData.get();
        if (md != null) {
            try {
                return md.duplicate();
            } catch (Exception e) {
            }
        }
        return md;
    }
3832
public ConversationMetaData getMetaData()
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getMetaData");
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getMetaData", metaData);      
      return metaData;   
   }
327082
public static void populateMetadata(AbstractComputeInstanceMetadata instanceMetadata, Map<?, ?> metadata) {
        if (metadata != null) {
            Map<String, String> finalMetadata = new HashMap<>(metadata.size());
            for (Map.Entry<?, ?> entry : metadata.entrySet()) {
                Object key = entry.getKey();
                Object value = entry.getValue();
                if (value instanceof String) {
                    finalMetadata.put(key.toString(), value.toString());
                }
            }
            instanceMetadata.setMetadata(finalMetadata);
        }
    }
1087149
static TokenLifeCycleManager getInstance(final String iamEndpoint,
            final String apiKey) {
        if (iamEndpoint == null || iamEndpoint.isEmpty()) {
            throw new IllegalArgumentException(
                    "Cannot initialize with null or empty IAM endpoint.");
        }
        if (apiKey == null || apiKey.isEmpty()) {
            throw new IllegalArgumentException(
                    "Cannot initialize with null or empty IAM apiKey.");
        }
        return getInstanceUnchecked(iamEndpoint, apiKey);
    }