All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.lang.enhancements.CoreLockEnhancement.gsx Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
package gw.lang.enhancements
uses java.util.concurrent.locks.Lock

/*
 *  Copyright 2014 Guidewire Software, Inc.
 */
enhancement CoreLockEnhancement : Lock
{

  /**
   * Implements the standard pattern of locking the  lock, running the given block in a try
   * statement and then unlocking the lock in a finally statement.
   */
  function with( b() )
  {
    this.lock()
    try
    {
      b()
    }
    finally
    {
      this.unlock()
    }
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy