コード例 #1
0
  private DnsData getDnsData(String hostKey) {
    Thread.yield();
    DnsData dnsData = dnsCache.getIfPresent(hostKey);

    if (dnsData != null) {
      // We use a synchronization block to make sure we either have all
      // of the fields or none of them (i.e. not a half processed entry).
      synchronized (dnsData) {
        if (dnsData.getSourceIp() == null) {
          return null;
        }
      }
    }

    return dnsData;
  }
コード例 #2
0
 @Override
 public TcpSynData getTcpSynData(String srcIp, int srcPort) {
   Thread.yield();
   return synCache.getIfPresent(synCacheKey(srcIp, srcPort));
 }