Program: 175395
Project: 175395
Buggy source:
/** 
 * 新产生的种子,如果入库,那么会消重。后加入的种子被reject
 * @param seeds 种子
 */
public void addNewSeeds(Collection<Seed> seeds){
  if (isClosed) {
    log.warn("String_Node_Str");
    return;
  }
  Multimap<String,Seed> segmentSeeds=HashMultimap.create();
  for (  Seed seed : seeds) {
    if (seed.getActiveTimeStamp() != null) {
      segmentSeeds.put(String.valueOf(segmentResolver.resolveSegmentKey(seed.getActiveTimeStamp())),seed);
    }
 else {
      segmentSeeds.put(defaultSegment,seed);
    }
  }
  int realAddSeedNumber=0;
  for (  Map.Entry<String,Collection<Seed>> entry : segmentSeeds.asMap().entrySet()) {
    Database runningSeedDatabase=null;
    Database finishedSeedDatabase=null;
    BloomFilter<Seed> bloomFilter=getOrCreate(entry.getKey());
    try {
      lockDBOperate();
      runningSeedDatabase=createOrGetDataBase(RUNNING_SEGMENT_PREFIX + entry.getKey());
      finishedSeedDatabase=createOrGetDataBase(FINISHED_SEGMENT_PREFIX + entry.getKey());
      for (      Seed seed : entry.getValue()) {
        if (bloomFilter.mightContain(seed)) {
          continue;
        }
        if (!StringUtils.equals(entry.getKey(),defaultSegment) && !allSegments.contains(Long.parseLong(entry.getKey()))) {
          allSegments.add(Long.parseLong(entry.getKey()));
          runningSegments.add(Long.parseLong(entry.getKey()));
        }
        DatabaseEntry key=new DatabaseEntry(seedKeyResolver.resolveSeedKey(seed).getBytes());
        DatabaseEntry valueEntry=new DatabaseEntry();
        if (runningSeedDatabase.get(null,key,valueEntry,LockMode.DEFAULT) == OperationStatus.SUCCESS || finishedSeedDatabase.get(null,key,valueEntry,LockMode.DEFAULT) == OperationStatus.SUCCESS) {
          continue;
        }
        DatabaseEntry value=new DatabaseEntry(VSCrawlerCommonUtil.transferSeedToString(seed).getBytes());
        runningSeedDatabase.putNoOverwrite(null,key,value);
        realAddSeedNumber++;
        bloomFilter.put(seed);
        if (isSeedEmpty.compareAndSet(true,false)) {
          if (seed.getActiveTimeStamp() == null) {
            vsCrawlerContext.getAutoEventRegistry().findEventDeclaring(FirstSeedPushEvent.class).firstSeed(vsCrawlerContext,seed);
          }
 else {
            vsCrawlerContext.getAutoEventRegistry().createDelayEventSender(FirstSeedPushEvent.class).sendDelay(seed.getActiveTimeStamp() - System.currentTimeMillis() + 10L).delegate().firstSeed(vsCrawlerContext,seed);
          }
        }
      }
      log.info("String_Node_Str",realAddSeedNumber);
    }
  finally {
      unlockDBOperate();
    }
  }
}

Fixed version (ground truth):
/** 
 * 新产生的种子,如果入库,那么会消重。后加入的种子被reject
 * @param seeds 种子
 */
public void addNewSeeds(Collection<Seed> seeds){
  if (isClosed) {
    log.warn("String_Node_Str");
    return;
  }
  Multimap<String,Seed> segmentSeeds=HashMultimap.create();
  for (  Seed seed : seeds) {
    if (seed.getActiveTimeStamp() != null) {
      segmentSeeds.put(String.valueOf(segmentResolver.resolveSegmentKey(seed.getActiveTimeStamp())),seed);
    }
 else {
      segmentSeeds.put(defaultSegment,seed);
    }
  }
  int realAddSeedNumber=0;
  for (  Map.Entry<String,Collection<Seed>> entry : segmentSeeds.asMap().entrySet()) {
    BloomFilter<Seed> bloomFilter=getOrCreate(entry.getKey());
    try {
      lockDBOperate();
      Database runningSeedDatabase=createOrGetDataBase(RUNNING_SEGMENT_PREFIX + entry.getKey());
      Database finishedSeedDatabase=createOrGetDataBase(FINISHED_SEGMENT_PREFIX + entry.getKey());
      for (      Seed seed : entry.getValue()) {
        if (bloomFilter.mightContain(seed)) {
          continue;
        }
        if (!StringUtils.equals(entry.getKey(),defaultSegment) && !allSegments.contains(Long.parseLong(entry.getKey()))) {
          allSegments.add(Long.parseLong(entry.getKey()));
          runningSegments.add(Long.parseLong(entry.getKey()));
        }
        DatabaseEntry key=new DatabaseEntry(seedKeyResolver.resolveSeedKey(seed).getBytes());
        DatabaseEntry valueEntry=new DatabaseEntry();
        if (runningSeedDatabase.get(null,key,valueEntry,LockMode.DEFAULT) == OperationStatus.SUCCESS || finishedSeedDatabase.get(null,key,valueEntry,LockMode.DEFAULT) == OperationStatus.SUCCESS) {
          continue;
        }
        DatabaseEntry value=new DatabaseEntry(VSCrawlerCommonUtil.transferSeedToString(seed).getBytes());
        runningSeedDatabase.putNoOverwrite(null,key,value);
        realAddSeedNumber++;
        bloomFilter.put(seed);
        if (isSeedEmpty.compareAndSet(true,false)) {
          if (seed.getActiveTimeStamp() == null) {
            vsCrawlerContext.getAutoEventRegistry().findEventDeclaring(FirstSeedPushEvent.class).firstSeed(vsCrawlerContext,seed);
          }
 else {
            vsCrawlerContext.getAutoEventRegistry().createDelayEventSender(FirstSeedPushEvent.class).sendDelay(seed.getActiveTimeStamp() - System.currentTimeMillis() + 10L).delegate().firstSeed(vsCrawlerContext,seed);
          }
        }
      }
      log.info("String_Node_Str",realAddSeedNumber);
    }
  finally {
      unlockDBOperate();
    }
  }
}