Administering OSGi-enabled services using the xscmd utility

You can use the xscmd utility to complete administrator tasks, such as viewing services and their rankings that are being used by each container, and updating the runtime environment to use new versions of the bundles.

About this task

With the Eclipse Equinox OSGi framework, you can install multiple versions of the same bundle, and you can update those bundles during run time. WebSphere® eXtreme Scale is a distributed environment that runs the container servers in many OSGi framework instances.

Administrators are responsible for manually copying, installing, and starting bundles into the OSGi framework. eXtreme Scale includes an OSGi ServiceTrackerCustomizer to track any services that have been identified as eXtreme Scale plug-ins in the ObjectGrid descriptor XML file. Use the xscmd utility to validate which version of the plug-in is used, which versions are available to be used, and to perform bundle upgrades.

eXtreme Scale uses the service ranking number to identify the version of each service. When two or more services are loaded with the same reference, eXtreme Scale automatically uses the service with the highest ranking.

Procedure

  • Run the osgiCurrent command, and verify that each eXtreme Scale server is using the correct plug-in service ranking.

    Since eXtreme Scale automatically chooses the service reference with the highest ranking, it is possible that the data grid may start with multiple rankings of a plug-in service.

    If the command detects a mismatch of rankings or if it is unable to find a service, a non-zero error level is set. If the command completed successfully then the error level is set to 0.

    The following example shows the output of the osgiCurrent command when two plug-ins are installed in the same grid on four servers. The loaderPlugin plug-in is using ranking 1, and the txCallbackPlugin is using ranking 2.

    OSGi Service Name Current Ranking ObjectGrid Name MapSet Name Server Name
    ----------------- --------------- --------------- ----------- -----------
    loaderPlugin      1               MyGrid          MapSetA     server1
    loaderPlugin      1               MyGrid          MapSetA     server2
    loaderPlugin      1               MyGrid          MapSetA     server3
    loaderPlugin      1               MyGrid          MapSetA     server4
    txCallbackPlugin  2               MyGrid          MapSetA     server1
    txCallbackPlugin  2               MyGrid          MapSetA     server2
    txCallbackPlugin  2               MyGrid          MapSetA     server3
    txCallbackPlugin  2               MyGrid          MapSetA     server4
    The following example shows the output of the osgiCurrent command when server2 was started with a newer ranking of the loaderPlugin:
    OSGi Service Name Current Ranking ObjectGrid Name MapSet Name Server Name
    ----------------- --------------- --------------- ----------- -----------
    loaderPlugin      1               MyGrid          MapSetA     server1
    loaderPlugin      2               MyGrid          MapSetA     server2
    loaderPlugin      1               MyGrid          MapSetA     server3
    loaderPlugin      1               MyGrid          MapSetA     server4
    txCallbackPlugin  2               MyGrid          MapSetA     server1
    txCallbackPlugin  2               MyGrid          MapSetA     server2
    txCallbackPlugin  2               MyGrid          MapSetA     server3
    txCallbackPlugin  2               MyGrid          MapSetA     server4
  • Run the osgiAll command to verify that the plug-in services have been correctly started on each eXtreme Scale container server.

    When bundles start that contain services that an ObjectGrid configuration is referencing, the eXtreme Scale runtime environment automatically tracks the plug-in, but does not immediately use it. The osgiAll command shows which plug-ins are available for each server.

    When run without any parameters, all services are shown for all grids and servers. Additional filters, including the -serviceName <service_name> filter can be specified to limit the output to a single service or a subset of the data grid.

    The following example shows the output of the osgiAll command when two plug-ins are started on two servers. The loaderPlugin has both rankings 1 and 2 started and the txCallbackPlugin has ranking 1 started. The summary message at the end of the output confirms that both servers see the same service rankings:
    Server: server1
       OSGi Service Name   Available Rankings
       -----------------   ------------------
       loaderPlugin        1, 2
       txCallbackPlugin    1
    
    Server: server2
       OSGi Service Name   Available Rankings
       -----------------   ------------------
       loaderPlugin        1, 2
       txCallbackPlugin    1
    
    Summary - All servers have the same service rankings.
    The following example shows the output of the osgiAll command when the bundle that includes the loaderPlugin with ranking 1 is stopped on server1. The summary message at the bottom of the output confirms that server1 is now missing the loaderPlugin with ranking 1:
    Server: server1
       OSGi Service Name   Available Rankings
       -----------------   ------------------
       loaderPlugin        2
       txCallbackPlugin    1
    
    Server: server2
       OSGi Service Name   Available Rankings
       -----------------   ------------------
       loaderPlugin        1, 2
       txCallbackPlugin    1
    
    Summary - The following servers are missing service rankings:
       Server  OSGi Service Name Missing Rankings
       ------  ----------------- ----------------
       server1 loaderPlugin      1 
    The following example shows the output if the service name is specified with the -sn argument, but the service does not exist:
    Server: server2
       OSGi Service Name Available Rankings
       ----------------- ------------------
       invalidPlugin     No service found
    
    Server: server1
       OSGi Service Name Available Rankings
       ----------------- ------------------
       invalidPlugin     No service found
    
    Summary - All servers have the same service rankings.
  • Run the osgiCheck command to check sets of plug-in services and rankings to see if they are available.

    The osgiCheck command accepts one or more sets of service rankings in the form: -serviceRankings <service name>;<ranking>[,<serviceName>;<ranking>]

    When the rankings are all available, the method returns with an error level of 0. If one or more rankings are not available, a non-zero error level is set. A table of all of the servers that do not include the specified service rankings is displayed. Additional filters can be used to limit the service check to a subset of the available servers in the eXtreme Scale domain.

    For example, if the specified ranking or service is absent, the following message is displayed:
    Server  OSGi Service Unavailable Rankings
    ------  ------------ --------------------
    server1 loaderPlugin 3
    server2 loaderPlugin 3
  • Run the osgiUpdate command to update the ranking of one or more plug-ins for all servers in a single ObjectGrid and MapSet in a single operation.

    The command accepts one or more sets of service rankings in the form: -serviceRankings <service name>;<ranking>[,<serviceName>;<ranking>] -g <grid name> -ms <mapset name>

    With this command, you can complete the following operations:
    • Verify that the specified services are available for updating on each of the servers.
    • Change the state of the grid to offline using the StateManager interface. See Managing ObjectGrid availability for more information. This process quiesces the grid and waits until any running transactions have completed and prevents any new transactions from starting. This process also signals any ObjectGridLifecycleListener and BackingMapLifecycleListener plug-ins to discontinue any transactional activity. See Plug-ins for providing event listeners for information about event listener plug-ins.
    • Update each eXtreme Scale container running in an OSGi framework to use the new service versions.
    • Changes the state of the grid to online, allowing transactions to continue.

    The update process is idempotent so that if a client fails to complete any one task, it results in the operation being rolled back. If a client is unable to perform the rollback or is interrupted during the update process, the same command can be issued again, and it continues at the appropriate step.

    If the client is unable to continue, and the process is restarted from another client, use the -force option to allow the client to perform the update. The osgiUpdate command prevents multiple clients from updating the same map set concurrently. For more details about the osgiUpdate command, see Updating OSGi services for eXtreme Scale plug-ins with xscmd.