mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
[MNT-25242] Add property to control if scope is cleaned (#3520)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -124,6 +124,9 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
|
||||
/** Number of (bytecode) instructions that will trigger the observer */
|
||||
private int observerInstructionCount = 100;
|
||||
|
||||
/** Flag to enable or disable scope cleaning at the end of each script execution */
|
||||
private boolean cleanScope = true;
|
||||
|
||||
/** Custom context factory */
|
||||
public static AlfrescoContextFactory contextFactory;
|
||||
|
||||
@@ -210,6 +213,15 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
|
||||
this.observerInstructionCount = observerInstructionCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cleanScope
|
||||
* true to enable scope cleaning at the end of each script execution - set to false to disable this feature.
|
||||
*/
|
||||
public void setCleanScope(boolean cleanScope)
|
||||
{
|
||||
this.cleanScope = cleanScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.repository.ScriptProcessor#reset()
|
||||
*/
|
||||
@@ -619,7 +631,7 @@ public class RhinoScriptProcessor extends BaseProcessor implements ScriptProcess
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (!secure)
|
||||
if (!secure && cleanScope)
|
||||
{
|
||||
unsetScope(model, scope);
|
||||
}
|
||||
|
@@ -1394,6 +1394,9 @@ scripts.execution.maxMemoryUsedInBytes=-1
|
||||
# Number of instructions that will trigger the observer
|
||||
scripts.execution.observerInstructionCount=5000
|
||||
|
||||
# Flag to control if the scope is cleaned at the end of script execution
|
||||
scripts.execution.clean.scope=true
|
||||
|
||||
# Default value being used in POST/size-details endpoint to partition a huge folder into smaller chunks
|
||||
# so that we can compute more efficiently and consolidate all sizes into a single unit.
|
||||
default.async.folder.items=1000
|
||||
|
@@ -60,6 +60,9 @@
|
||||
<property name="observerInstructionCount">
|
||||
<value>${scripts.execution.observerInstructionCount}</value>
|
||||
</property>
|
||||
<property name="cleanScope">
|
||||
<value>${scripts.execution.clean.scope}</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- base config implementation that script extension beans extend from - for auto registration
|
||||
|
Reference in New Issue
Block a user