Class DataProviderServer

java.lang.Object
com.lightstreamer.adapters.remote.Server
com.lightstreamer.adapters.remote.DataProviderServer

public class DataProviderServer
extends Server
A Remote Server object which can run a Remote Data Adapter and connect it to a Proxy Data Adapter running on Lightstreamer Server.
The object should be provided with a DataProvider instance and with suitable initialization parameters and established connections, then activated through Server.start() and finally disposed through Server.close(). Further reuse of the same instance is not supported.
By default, the invocations to the Data Adapter methods will be done in an unlimited thread pool. A thread pool maximum size can be specified through the custom "lightstreamer.data.pool.size" system property; a size of 0 or negative also implies an unlimited thread pool.
Note that Subscribe and Unsubscribe invocations for the same item are always guaranteed to be sequentialized in the right way, although they may not occur in the same thread.
  • Constructor Details

    • DataProviderServer

      public DataProviderServer()
      Creates an empty server still to be configured and started. The init method of the Remote Adapter will be invoked only upon a Proxy Adapter request.
      Throws:
      java.lang.IllegalArgumentException - in case something wrong is supplied in system properties related with Data Adapter processing.
    • DataProviderServer

      @Deprecated public DataProviderServer​(boolean initializeOnStart)
      Deprecated.
      This constructor is deprecated, because the setting of initializeOnStart as true is going to be no longer supported. Use the other constructor, which implies initializeOnStart as false. As a consequence of this replacement, the init method of the DataProvider implementation object would be invoked only after the connection and it would receive additional parameters sent by the Proxy Adapter. If any initialization stuff on the DataProvider implementation object has to be performed earlier, it should be done through a dedicated method before invoking start. As another consequence, the start method would no longer throw a DataAdapterException; any related catch block could safely assert false.
      Creates an empty server still to be configured and started.
      Parameters:
      initializeOnStart - If true, the init method of the Remote Adapter will be invoked immediately rather than upon a Proxy Adapter request. The Proxy Adapter request will then just receive a successful answer. This can shorten the connection phase, which will start only after the return of Init; on the other hand, any initialization parameters supplied by the Proxy Adapter will not be available.
      Throws:
      java.lang.IllegalArgumentException - in case something wrong is supplied in system properties related with Data Adapter processing.
  • Method Details

    • setAdapter

      public final void setAdapter​(@Nonnull DataProvider adapter)
      Sets the Remote Data Adapter instance to be run.
      Parameters:
      adapter - the Remote Data Adapter instance to be run.
    • getAdapter

      @Nonnull public final DataProvider getAdapter()
      Gets the configured Data Adapter that is running or will run.
      Returns:
      the configured Data Adapter
    • setAdapterParams

      public final void setAdapterParams​(@Nonnull java.util.Map<java.lang.String,​java.lang.String> params)
      Sets a Map object to be passed to the init method of the Remote Data Adapter, to supply optional parameters.
      The default value is an empty HashMap.
      Parameters:
      params - the Map to be passed to the init method of the Remote Data Adapter
      See Also:
      DataProvider.init(Map, String)
    • getAdapterParams

      @Nonnull public final java.util.Map<java.lang.String,​java.lang.String> getAdapterParams()
      Gets the Map object to be passed to the init method of the Remote Data Adapter, to supply optional parameters.
      The default value is an empty HashMap.
      Returns:
      the Map object to be passed to the init method of the Remote Data Adapter
      See Also:
      DataProvider.init(Map, String)
    • setAdapterConfig

      public final void setAdapterConfig​(@Nullable java.lang.String configFile)
      Sets the pathname of an optional configuration file for the Remote Data Adapter, to be passed to the init method.
      The default value is null.
      Parameters:
      configFile - the pathname of an optional configuration file for the Remote Data Adapter.
      See Also:
      DataProvider.init(Map, String)
    • getAdapterConfig

      @Nullable public final java.lang.String getAdapterConfig()
      Gets the pathname of an optional configuration file for the Remote Data Adapter, to be passed to the init method.
      The default value is null.
      Returns:
      the pathname of an optional configuration file for the Remote Data Adapter
      See Also:
      DataProvider.init(Map, String)