Results 1 to 5 of 5

Threaded View

  1. #2
    What does the method switchToAlternateConnection do exactly?
    Does it call a blocking operation such as wait() or similar commands?

    Indeed you don’t need to block a thread in order to wait for the connected status. You can simply create a new client (or reuse the old one) and register a ClientListener.

    For example:

    Code:
    void onStatusChange(String status) {
      switch (status) {
      case "DISCONNECTED":
        var newClient = new LightstreamerClient(...)
        newClient.addListener(
          void onStatusChange(status) {
            switch (status) {
            case "CONNECTED:WS-STREAMING":
              // complete the configuration
            }
          })
        newClient.connect()
      }
    }
    Since the methods of LightstreamerClient are asynchronous and reentrant, they work as expected.
    Last edited by Alessandro Carioni; July 27th, 2023 at 09:42 AM.

 

 

Similar Threads

  1. Data source parsing problem
    By shabbirh in forum Client SDKs
    Replies: 2
    Last Post: September 28th, 2012, 10:00 AM
  2. Multithreading in Java Adapter
    By achittoda in forum Adapter SDKs
    Replies: 1
    Last Post: December 21st, 2009, 10:05 AM
  3. Newbe: LightStreamer and WSDL source for Adapter
    By Dr.Dran in forum Adapter SDKs
    Replies: 0
    Last Post: April 27th, 2009, 02:53 PM
  4. Interaction demo source code
    By sarbao in forum General
    Replies: 1
    Last Post: April 16th, 2009, 08:59 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 11:37 PM.