ServiceLoader
 

ServiceLoader

4 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    08 Jan 2020
    Link to this post
    We use the services.xml to load up some of our app services.

    We have entries similar to the following where we use RequiredDatabases.

    <ttServiceLoaderRow>
        <Order>60</Order>
        <ServiceTypeName>Osprey.Framework.Server.ILegacyFrameworkService</ServiceTypeName>
        <ServiceClassName>Osprey.Framework.Server.LegacyFrameworkService</ServiceClassName>
     <RequiredDatabases>host,histlog</RequiredDatabases>
      </ttServiceLoaderRow>

    Even though we are using <RequiredDatabases> the service is still trying to load even if we are not connected to these databases.

    The following code starting on line 340 in ServiceLoader:Load does not appear to work.

        IF hBuffer::RequiredDatabases > "":U THEN DO ON ERROR UNDO, THROW:
                    DO i = 1 TO NUM-ENTRIES (hBuffer::RequiredDatabases) ON ERROR UNDO, THROW:
                        IF ENTRY (i, hBuffer::RequiredDatabases) = "SmartDB":U THEN
                            IF NOT CONNECTED (cSmartDB) THEN
                                NEXT serviceLoop .
                        ELSE
                            IF NOT CONNECTED (ENTRY (i, hBuffer::RequiredDatabases)) THEN
                                NEXT serviceLoop .
                    END.
                END.

     If I change this code to the following it works just fine. Am I missing something?

     IF hBuffer::RequiredDatabases > "":U THEN DO ON ERROR UNDO, THROW:
                    DO i = 1 TO NUM-ENTRIES (hBuffer::RequiredDatabases) ON ERROR UNDO, THROW:
                        IF ENTRY (i, hBuffer::RequiredDatabases) = "SmartDB":U THEN
                        DO:
                            IF NOT CONNECTED (cSmartDB) THEN
                                NEXT serviceLoop .
                        END.
                        ELSE
                            IF NOT CONNECTED (ENTRY (i, hBuffer::RequiredDatabases)) THEN
                                NEXT serviceLoop .
                    END.
                END.



  2. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    08 Jan 2020 in reply to Roger Blanchard
    Link to this post
    In looking at this same METHOD before I upgraded to latest SCL (yesterday) the code is as follows;

        IF hBuffer::RequiredDatabases > "":U THEN DO ON ERROR UNDO, THROW:
                    DO i = 1 TO NUM-ENTRIES (hBuffer::RequiredDatabases) ON ERROR UNDO, THROW:
                        IF NOT CONNECTED (ENTRY (i, hBuffer::RequiredDatabases)) THEN
                            NEXT serviceLoop .
                    END.
                END.
  3. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    Answered
    08 Jan 2020 in reply to Roger Blanchard
    Link to this post
    We are already looking in this issue. 

    Please report technical issues using JIRA service desk and not the forum. 
  4. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    20 Jan 2020 in reply to Mike Fechner
    Link to this post
    this is fixed in latest release.

    thanks,
4 posts, 1 answered