Package com.loop54

Class Loop54ClientProvider

java.lang.Object
com.loop54.Loop54ClientProvider
All Implemented Interfaces:
ILoop54ClientProvider, Closeable, AutoCloseable

public class Loop54ClientProvider extends Object implements ILoop54ClientProvider
Class for handling multiple instances of ILoop54Client. Should be used if working against multiple instances of the Loop54 e-commerce search engine from the same application. The class is thread safe.
  • Constructor Details

    • Loop54ClientProvider

      public Loop54ClientProvider(IRemoteClientInfoProvider remoteClientInfoProvider, Loop54SettingsCollection settingsCollection)
      Parameters:
      remoteClientInfoProvider - The client info provider to use in the clients.
      settingsCollection - One or more settings to setup clients for.
  • Method Details

    • getNamed

      public ILoop54Client getNamed(String instanceName)
      Get a named instance of ILoop54Client. Will throw if an instance with the same name is not found.
      Specified by:
      getNamed in interface ILoop54ClientProvider
      Parameters:
      instanceName - Name of a instance. For example 'swedish', 'english' or 'content'.
      Returns:
      The named instance.
    • getSingleOrThrow

      public ILoop54Client getSingleOrThrow()
    • close

      public void close() throws IOException
      Closes all clients and releases any system resources associated with them. After calling this method, the provider and its clients should no longer be used.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - if an I/O error occurs while closing any of the clients