Where to use GlideSelfCleaningMutex

pradeepgupta
Giga Expert

Hi All,

I wanted to understand use of GlideSelfCleaningMutexm. There is one OOB functionality in event management where GlideSelfCleaningMutex has been used.

Can any one help me to understand below line of code:

EvtMgmtIncidentHandler.createIncident = function(alert, autoOpen) {

  var mutex = new GlideSelfCleaningMutex('alert_' + alert.sys_id);

  gs.log('Event insideEvtMgmtIncidentHandler.createIncident alert.sys_id: '+alert.sys_id);

  mutex.get();

  try {

  var gr = new GlideRecord('em_alert');

  gr.get(alert.sys_id);

  if (!gr.incident.nil()) {

  return false; // Don't create incident on alert if it already has one

  }

  var createdIncident = EvtMgmtIncidentHandler.createIncidentNoUpdate(gr, autoOpen);

  if (createdIncident) {

  gr.update();

  }

  return createdIncident;

  } finally {

  mutex.release();

  }

};

1 REPLY 1

Paul Curwen
Giga Sage

I was also investigating this, but it's still undocumented see the comments in this from Chuck:

https://community.servicenow.com/community?id=community_question&sys_id=5c25476ddbd8dbc01dcaf3231f96...

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul