[concurrency-interest] Creating a Set of pings
robertlazarski at gmail.com
Mon May 22 20:54:52 EDT 2006
Could someone please give some advice on these requirements?
1) Find all IP's on a given subnet that responds to ICMP (ping). So for say
192.168.10.0 with a netmask of 255.255.255.0, attempt a ping to 255
addresses. In java I believe I can use InetAddress.isReachable(timeout) .
2) On a valid IP, try to connect on port 161 via UDP and snmp.
3) Put the valid IP's inside an implementation of java.util.Set .
4) Compare new Set with a previous Set and show updates.
My questions are:
1) Perform steps 1, 2, and possibly 3 in a Callable or Runnable. On typical
intel hardware does an ExecutorService with a size of 5 sound about right?
2) Should I pass in a Callable and get the results back 255 times, or should
I use Runnable and have the threads write the result to a common area, ie,
an object with a synchronized method ?
3) Should I use one of the concurrent collections to store the results?
CopyOnWriteArrayList seems to fit.
Thanks for any help,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest