Source:
<code>private void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); if (knownSegments == null || !knownSegments.containsKey(segment)) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Map<String, Set<String>> serverSegmentMap = new HashMap<>(); serverSegmentMap.put(segment.getIdentifier(), Sets.newHashSet(server.getName())); final long isPublished = 0; <START> final long isAvailable = 1; <END> final SegmentMetadataHolder holder = new SegmentMetadataHolder.Builder( segment.getIdentifier(), isPublished, isAvailable, isRealtime, serverSegmentMap ).build(); setSegmentSignature(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getIdentifier()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getIdentifier()); } } else { if (knownSegments.containsKey(segment)) { final SegmentMetadataHolder holder = knownSegments.get(segment); final Map<String, Set<String>> segmentServerMap = holder.getsegmentServerMap(); final Set<String> servers = segmentServerMap.get(segment.getIdentifier()); servers.add(server.getName()); segmentServerMap.put(segment.getIdentifier(), servers); final SegmentMetadataHolder holderWithNumReplicas = new SegmentMetadataHolder.Builder( holder.getSegmentId(), holder.isPublished(), holder.isAvailable(), holder.isRealtime(), holder.getsegmentServerMap() ).withNumReplicas(segmentServerMap).build(); knownSegments.put(segment, holderWithNumReplicas); } if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getIdentifier()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }</code><technical_language>static constants somewhere</technical_language>

Target:
private void addSegment(final DruidServerMetadata server, final DataSegment segment) { synchronized (lock) { final Map<DataSegment, SegmentMetadataHolder> knownSegments = segmentMetadataInfo.get(segment.getDataSource()); if (knownSegments == null || !knownSegments.containsKey(segment)) { final long isRealtime = server.segmentReplicatable() ? 0 : 1; final Map<String, Set<String>> serverSegmentMap = ImmutableMap.of( segment.getIdentifier(), ImmutableSet.of(server.getName()) ); final SegmentMetadataHolder holder = new SegmentMetadataHolder.Builder( segment.getIdentifier(), IS_PUBLISHED, IS_AVAILABLE, isRealtime, serverSegmentMap ).build(); setSegmentSignature(segment, holder); segmentsNeedingRefresh.add(segment); if (!server.segmentReplicatable()) { log.debug("Added new mutable segment[%s].", segment.getIdentifier()); mutableSegments.add(segment); } else { log.debug("Added new immutable segment[%s].", segment.getIdentifier()); } } else { if (knownSegments.containsKey(segment)) { final SegmentMetadataHolder holder = knownSegments.get(segment); final Map<String, Set<String>> segmentServerMap = holder.getReplicas(); final ImmutableSet<String> servers = new ImmutableSet.Builder<String>() .addAll(segmentServerMap.get(segment.getIdentifier())) .add(server.getName()) .build(); final SegmentMetadataHolder holderWithNumReplicas = new SegmentMetadataHolder.Builder( holder.getSegmentId(), holder.isPublished(), holder.isAvailable(), holder.isRealtime(), holder.getReplicas() ).withReplicas(ImmutableMap.of(segment.getIdentifier(), servers)).build(); knownSegments.put(segment, holderWithNumReplicas); } if (server.segmentReplicatable()) { mutableSegments.remove(segment); log.debug("Segment[%s] has become immutable.", segment.getIdentifier()); } } if (!tables.containsKey(segment.getDataSource())) { refreshImmediately = true; } lock.notifyAll(); } }