MCPcopy Create free account
hub / github.com/apache/nutch / get

Method get

src/java/org/apache/nutch/host/HostDb.java:107–128  ·  view source on GitHub ↗
(final String key)

Source from the content-addressed store, hash-verified

105 }
106
107 public Host get(final String key) throws IOException {
108 Callable<CacheHost> valueLoader = new Callable<CacheHost>() {
109 @Override
110 public CacheHost call() throws Exception {
111 Host host = hostStore.get(key);
112 if (host == null)
113 return NULL_HOST;
114 return new CacheHost(host, System.currentTimeMillis());
115 }
116 };
117 CacheHost cachedHost;
118 try {
119 cachedHost = cache.get(key, valueLoader);
120 } catch (ExecutionException e) {
121 throw new RuntimeException(e);
122 }
123 if (cachedHost != NULL_HOST) {
124 return cachedHost.host;
125 } else {
126 return null;
127 }
128 }
129
130 public Host getByHostName(String hostName) throws IOException {
131 return get(TableUtil.reverseHost(hostName));

Callers 1

getByHostNameMethod · 0.95

Calls 1

getMethod · 0.65

Tested by

no test coverage detected