core/src/main/java/com/orientechnologies/orient/core/command/script/OScriptManager.java
public OPartitionedObjectPool.PoolEntry<ScriptEngine> acquireDatabaseEngine(final String databaseName, final String language) {
    ODatabaseScriptManager dbManager = dbManagers.get(databaseName);
    if (dbManager == null) {
      // CREATE A NEW DATABASE SCRIPT MANAGER
      dbManager = new ODatabaseScriptManager(this, databaseName);
      final ODatabaseScriptManager prev = dbManagers.putIfAbsent(databaseName, dbManager);
      if (prev != null) {
        dbManager.close();
        // GET PREVIOUS ONE
        dbManager = prev;
      }
    }

    return dbManager.acquireEngine(language);
  }
public OPartitionedObjectPool.PoolEntry<ScriptEngine> acquireDatabaseEngine(final String databaseName, final String language) {
    ODatabaseScriptManager dbManager = dbManagers.get(databaseName);
    if (dbManager == null) {
      // CREATE A NEW DATABASE SCRIPT MANAGER
      dbManager = new ODatabaseScriptManager(this, databaseName);
      final ODatabaseScriptManager prev = dbManagers.putIfAbsent(databaseName, dbManager);
      if (prev != null) {
        dbManager.close();
        // GET PREVIOUS ONE
        dbManager = prev;
      }
    }

    return dbManager.acquireEngine(language);
  }
public OPartitionedObjectPool . PoolEntry < ScriptEngine > acquireDatabaseEngine ( final String databaseName , final String language ) { ODatabaseScriptManager dbManager = dbManagers . get ( databaseName ) ; if ( dbManager == null ) { // CREATE A NEW DATABASE SCRIPT MANAGER
 dbManager = new ODatabaseScriptManager ( this , databaseName ) ; final ODatabaseScriptManager prev = dbManagers . putIfAbsent ( databaseName , dbManager ) ; if ( prev != null ) { dbManager . close ( ) ; // GET PREVIOUS ONE
 dbManager = prev ; } } return dbManager . acquireEngine ( language ) ; }
Acquires a database engine from the pool. Once finished using it, the instance MUST be returned in the pool by calling the
method #releaseDatabaseEngine(String, ScriptEngine).

@param databaseName Database name
@param language     Script language
@return ScriptEngine instance with the function library already parsed
@see #releaseDatabaseEngine(String, String, OPartitionedObjectPool.PoolEntry)
Acquires a database engine from the pool . Once finished using it the instance MUST be returned in the pool by calling the method #releaseDatabaseEngine ( String ScriptEngine ) .