@@ -131,8 +131,9 @@ private RuntimeEnvironment() {
131
131
lzSearchExecutor = LazilyInstantiate .using (() -> newSearchExecutor ());
132
132
}
133
133
134
- /** Instance of authorization framework.*/
134
+ // Instance of authorization framework and its lock.
135
135
private AuthorizationFramework authFramework ;
136
+ private final Object authFrameworkLock = new Object ();
136
137
137
138
/** Gets the thread pool used for multi-project searches. */
138
139
public ExecutorService getSearchExecutor () {
@@ -1593,11 +1594,13 @@ public void setStatisticsFilePath(String path) {
1593
1594
*
1594
1595
* @return the framework
1595
1596
*/
1596
- public synchronized AuthorizationFramework getAuthorizationFramework () {
1597
- if (authFramework == null ) {
1598
- authFramework = new AuthorizationFramework (getPluginDirectory (), getPluginStack ());
1597
+ public AuthorizationFramework getAuthorizationFramework () {
1598
+ synchronized (authFrameworkLock ) {
1599
+ if (authFramework == null ) {
1600
+ authFramework = new AuthorizationFramework (getPluginDirectory (), getPluginStack ());
1601
+ }
1602
+ return authFramework ;
1599
1603
}
1600
- return authFramework ;
1601
1604
}
1602
1605
1603
1606
/**
@@ -1606,11 +1609,13 @@ public synchronized AuthorizationFramework getAuthorizationFramework() {
1606
1609
*
1607
1610
* @param fw the new framework
1608
1611
*/
1609
- public synchronized void setAuthorizationFramework (AuthorizationFramework fw ) {
1610
- if (this .authFramework != null ) {
1611
- this .authFramework .removeAll ();
1612
+ public void setAuthorizationFramework (AuthorizationFramework fw ) {
1613
+ synchronized (authFrameworkLock ) {
1614
+ if (this .authFramework != null ) {
1615
+ this .authFramework .removeAll ();
1616
+ }
1617
+ this .authFramework = fw ;
1612
1618
}
1613
- this .authFramework = fw ;
1614
1619
}
1615
1620
1616
1621
/**
0 commit comments