Class DiscoveryService
- java.lang.Object
-
- ca.cgjennings.apps.arkham.plugins.debugging.DiscoveryService
-
public final class DiscoveryService extends java.lang.Object
Searches for available debug servers.- Author:
- Chris Jennings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DiscoveryService.ServerInfo
Provides information about discovered debug servers.
-
Constructor Summary
Constructors Constructor Description DiscoveryService()
Create a new instance that will scan for servers running on the local device.DiscoveryService(java.net.InetAddress... hosts)
Create a new instance that will scan for servers on the specified hosts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Consumer<DiscoveryService.ServerInfo>
getDiscoveryConsumer()
Returns the current consumer that will be called for each discovered server as it is found.java.net.InetAddress[]
getHosts()
Returns the hosts to be searched.java.util.List<DiscoveryService.ServerInfo>
search()
Searches hosts for debug servers, returning information about each one found.void
setDiscoveryConsumer(java.util.function.Consumer<DiscoveryService.ServerInfo> consumer)
Sets an optional consumer that will be called for each discovered server Note that the callback may be called from any thread.void
setProgressListener(ProgressListener progress)
-
-
-
Constructor Detail
-
DiscoveryService
public DiscoveryService()
Create a new instance that will scan for servers running on the local device.
-
DiscoveryService
public DiscoveryService(java.net.InetAddress... hosts)
Create a new instance that will scan for servers on the specified hosts. Note that testing remote hosts is typically much slower than testing local hosts.- Parameters:
hosts
- Non-null array of hosts to test.
-
-
Method Detail
-
getHosts
public java.net.InetAddress[] getHosts()
Returns the hosts to be searched.- Returns:
- non-null array of hosts, possibly empty
-
setDiscoveryConsumer
public void setDiscoveryConsumer(java.util.function.Consumer<DiscoveryService.ServerInfo> consumer)
Sets an optional consumer that will be called for each discovered server Note that the callback may be called from any thread. The callback set at the start of any search will be used for the entire search.- Parameters:
consumer
- a server information consumer, or null for none
-
getDiscoveryConsumer
public java.util.function.Consumer<DiscoveryService.ServerInfo> getDiscoveryConsumer()
Returns the current consumer that will be called for each discovered server as it is found.- Returns:
- the current consumer, or null if none
-
setProgressListener
public void setProgressListener(ProgressListener progress)
-
search
public java.util.List<DiscoveryService.ServerInfo> search()
Searches hosts for debug servers, returning information about each one found.- Returns:
- non-null list of objects that describe discovered servers
-
-