Package gov.usgs.earthquake.indexer
Class SearchServerSocket
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.indexer.SearchServerSocket
- All Implemented Interfaces:
Configurable
,SocketListenerInterface
Server side of socket search interface.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default listen port, as a string.static final String
The default number of threads, as a string.static final String
The configuration property used to reference a ProductIndex.static final String
The configuration property used to reference a URLProductStorage.static final String
The configuration property used for listen port.static final String
The configuration property used for listen thread count. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process configuration settings.int
getPort()
int
void
This method is called each time a SearchSocket connects.protected SearchResponse
search
(SearchRequest request) Method to perform search.void
void
setPort
(int port) void
setThreads
(int threads) void
shutdown()
Stop any processing/background threads.void
startup()
Start any processing/background threads.Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
-
Field Details
-
SEARCH_PORT_PROPERTY
The configuration property used for listen port.- See Also:
-
DEFAULT_SEARCH_PORT
The default listen port, as a string.- See Also:
-
THREAD_POOL_SIZE_PROPERTY
The configuration property used for listen thread count.- See Also:
-
DEFAULT_THREAD_POOL_SIZE
The default number of threads, as a string.- See Also:
-
PRODUCT_INDEXER_PROPERTY
The configuration property used to reference a ProductIndex.- See Also:
-
PRODUCT_STORAGE_PROPERTY
The configuration property used to reference a URLProductStorage.- See Also:
-
-
Constructor Details
-
SearchServerSocket
public SearchServerSocket()Construct a new SearchServerSocket using defaults.
-
-
Method Details
-
search
Method to perform search. Calls Indexer.search(SearchRequest). Simplifies testing.- Parameters:
request
- the search to execute.- Returns:
- the search response.
- Throws:
Exception
- if error occurs
-
onSocket
This method is called each time a SearchSocket connects.- Specified by:
onSocket
in interfaceSocketListenerInterface
- Parameters:
socket
- socket to be processed.
-
configure
Description copied from class:DefaultConfigurable
Process configuration settings. Called before startup().- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultConfigurable
- Parameters:
config
- the Config object with settings.- Throws:
Exception
- if configuration exceptions occur.
-
shutdown
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in classDefaultConfigurable
- Throws:
Exception
- if exceptions occur while starting.
-
startup
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
Exception
- if exceptions occur while starting.
-
getPort
public int getPort()- Returns:
- int port
-
setPort
public void setPort(int port) - Parameters:
port
- int to set
-
getThreads
public int getThreads()- Returns:
- int threads
-
setThreads
public void setThreads(int threads) - Parameters:
threads
- into to set
-
getIndexer
- Returns:
- indexer
-
setIndex
- Parameters:
indexer
- to set
-