Skip to content

Commit d4a1453

Browse files
authored
Add a log message when using StunMappingCandidateHarvester. (#238)
* log: Add a log message when using StunMappingCandidateHarvester. * ref: Use lambda, fix formating.
1 parent d7c0e27 commit d4a1453

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/main/java/org/ice4j/ice/harvest/MappingCandidateHarvesters.java

+7-13
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ private static void maybeAdd(
199199
if (face.getAddress().equals(h.getFace().getAddress())
200200
&& mask.getAddress().equals(h.getMask().getAddress()))
201201
{
202-
logger.info("Discarding a mapping harvester with duplicate "
203-
+ "addresses: " + harvester + ". Kept: " + h);
202+
logger.info("Discarding a mapping harvester with duplicate addresses: " + harvester + ". Kept: " + h);
204203
return;
205204
}
206205
}
@@ -263,30 +262,25 @@ private static List<StunMappingCandidateHarvester> createStunHarvesters(@NotNull
263262
TransportAddress localAddress
264263
= new TransportAddress(localInetAddress, 0, Transport.UDP);
265264

265+
logger.info("Using " + remoteAddress + " for StunMappingCandidateHarvester (localAddress="
266+
+ localAddress + ").");
266267
final StunMappingCandidateHarvester stunHarvester
267268
= new StunMappingCandidateHarvester(
268269
localAddress,
269270
remoteAddress);
270271

271-
Callable<StunMappingCandidateHarvester> task
272-
= new Callable<StunMappingCandidateHarvester>()
272+
Callable<StunMappingCandidateHarvester> task = () ->
273273
{
274-
@Override
275-
public StunMappingCandidateHarvester call()
276-
throws Exception
277-
{
278-
stunHarvester.discover();
279-
return stunHarvester;
280-
}
274+
stunHarvester.discover();
275+
return stunHarvester;
281276
};
282277
tasks.add(task);
283278
}
284279
}
285280

286281
// Now run discover() on all created harvesters in parallel and pick
287282
// the ones which succeeded.
288-
ExecutorService es = ExecutorFactory.createFixedThreadPool(tasks.size(),
289-
"ice4j.Harvester-executor-");
283+
ExecutorService es = ExecutorFactory.createFixedThreadPool(tasks.size(), "ice4j.Harvester-executor-");
290284

291285
try
292286
{

0 commit comments

Comments
 (0)