Accelerate blog

Solutions for Popular Administrative Maintenance Tasks | Part 1

Written by Wael El-Khalil | May 16, 2022 9:03:30 PM

Reload Maximo Cache without Restart or Turning Admin Mode On/Off 

 Use Case:

Administrators must sometimes restart Maximo instances in order for their changes to be fully applied or even visible for the end users, one of the reasons is that Maximo stores many of its configurations in Cache HashMaps, and these Cache repositories are reloaded when Admin Mode is turned off or, obviously, when Maximo starts up, some of those changes may include:

  1. Adding / Modifying MaxLookupMap.
  2. Adding a new synonym domain internal value (Backend Change).
  3. Adding / Modifying MaxVars that are not available for editing (Backend Change).
  4. Making structural database changes, and running configdb command, instead of turning Admin Mode On/Off and applying configurations changes from the UI (This case occurs a lot in development environments).

Method and Reasoning: 

Maximo reloads its Cache automatically in the below cases: 

  • Upon Maximo JVM Startup, Maximo reloads the entire cache for the server being started. 
  • Turning off Admin Mode, Maximo reloads the entire cache for the all the servers. 
  • When making any changes from the Maximo frontend that requires reloading cache, Maximo reloads the cache related to that specific change, for instance, when changing a System Property value, and clicking Live Refresh action, Maximo refreshes the System Properties cache. But when updating a certain MaxVar in Security Controls or Organisation settings for instance, Maximo reloads only the cache value for that variable. 

There are 3 methods in the psdi.server.MXServer class we can use to reload the cache: 

reloadMaximoCache(boolean updateAllServers) : Reloads all Maximo Caches 

reloadMaximoCache(String cacheName, boolean updateAllServers) : Reloads specific Maximo Cache 

reloadMaximoCache(String cacheName, String key, boolean updateAllServers): Reloads a specific component of the Cache. 

We could easily use the first method, but I saw it is a good idea to use the same logic used by Maximo after Admin Mode is turned off. 

We should decide where to place such an action, the Database Configurations is a good application to launch this action from. That action will launch an automation script that will reload all the Maximo Cache repositories. 

Implementation: 

We will perform the below steps to add an action menu item, that will eventually launch an automation script:  

1. Go to Application Designer Application
2. Open the application definition for Message Tracking application.
3. From the Select Action menu, choose Add/Modify Signature Options. 
4. When the dialog is displayed, click New Row, and add the name and description of the action, for instance:

  1.  Option: MAXCACHE
  2.  Description: Reload Maximo Cache.

5. Expand the Advanced Signature Options and choose the option that reads: This is an action that must be invoked by user in the UI.
6. Click OK. 

 

7. From the Select Action menu, choose Add/Modify Select Action Menu.
8. When the dialog is displayed, click New Row, and add the details of the signature option you just created: 

  1. Element Type: Option 
  1. Key Value: MAXCACHE 
  1. Unique Position and Sub-Position, I chose a location just below the Apply Database Configurations action 
  1. Tabs: ALL.  

 Remember, for an automation script to run on the list tab, there should be at least one record in the results table.

9. Click OK

10. Do not forget to grant the access to run this action to the right security group. 

Reloading Maximo Cache might take several seconds to complete, so it is going to be very frustrating for the user if they click the action by mistake, therefore, it is a good idea to create a warning message for them. 

1. From the Select Action menu, choose Messages.

2. When the dialog is displayed, click New Row, and add the details of the warning message as in the below screenshot 

3. Click OK 

After that we have to create the automation script, we will use for this purpose an Action Launch Point:

1.Go to Automation Scripts application.

2. From the More Actions menu, choose Create Script with Action Launch Point.

3. Fill the Launch Point Name and description, and the Action name and description 

  1. Note: creating this launch point, will automatically create an Action in the Actions application.

4. Since Maximo will not allow us to use any internal object as a lunch point object, we cannot use MAXOBJECT or MAXOBJECTCFG for this launch point, but we can still use another object, I am using MAXUSER here.

5. Click Next 

 

6. Fill out the script name and description, then choose the language as Python.

7. Copy and paste the below script source code, then click Create

#----------------------------------------------------------------------- 
# Name:        MAXCACHE 
# Description: Reload Maximo Cache 

# @author Wael El-Khalil 
#----------------------------------------------------------------------- 
from psdi.server import MXServer 
 
userChoice = service.yncuserinput() 
if (userChoice == service.YNC_NULL): 
    service.yncerror("system", "maxCache") 
elif (userChoice == service.YNC_YES): 
    mxserver = MXServer.getMXServer() 
    cacheNames = mxserver.getMaximoCacheNames() 
 
    mxserver.reloadMaximoCache("MAXPROP", True) 
    mxserver.reloadMaximoCache("MAXIMODD", True) 
    mxserver.reloadMaximoCache("MAXIMOMLDD", True) 
    mxserver.reloadMaximoCache("MAXMESSAGECACHE", True) 
    mxserver.reloadMaximoCache("MAXVARS", True) 
     
    cacheNames.remove("ADMINMODE") 
    cacheNames.remove("MAXPROP") 
    cacheNames.remove("MAXIMODD") 
    cacheNames.remove("MAXIMOMLDD") 
    cacheNames.remove("MAXMESSAGECACHE") 
    cacheNames.remove("MAXVARS") 
 
    i = cacheNames.iterator() 
    while (i.hasNext()): 
        cacheName = i.next() 
       mxserver.reloadMaximoCache(cacheName, True)

 

 

Wael El-Khalil
IBM certified Maximo techno-functional Consultant

Wael is an IBM Certified Maximo techno-functional consultant since 2010, based in Brisbane, Australia, he gained his experience working for consultancy companies in the Middle East and Australia, and at the client side as Maximo Project Manager at the Roads and Transport Authority in Dubai. Throughout his Maximo years, he worked with clients such as Australian Gas Group, BP, Port Waratah Coal Services, ADNOC Group, DP World, Abu Dhabi Water and Electricity and helped them implement Maximo, its add-ons and industry solutions (Service Provider, Transportation, Oil and Gas, HS&E, Scheduler, etc..), and integrate it with systems such as Oracle E-Business Suite, SAP, JDE. SCADA. Vocollect, and many others.