Browse Source

Merge branch '6.0.x'

# Conflicts:
#	spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
pull/30963/head
Juergen Hoeller 2 years ago
parent
commit
376223c87d
  1. 10
      spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java
  2. 7
      spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java

10
spring-context/src/main/java/org/springframework/scheduling/annotation/SchedulingConfigurer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -40,10 +40,10 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar; @@ -40,10 +40,10 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
public interface SchedulingConfigurer {
/**
* Callback allowing a {@link org.springframework.scheduling.TaskScheduler
* TaskScheduler} and specific {@link org.springframework.scheduling.config.Task Task}
* instances to be registered against the given the {@link ScheduledTaskRegistrar}.
* @param taskRegistrar the registrar to be configured.
* Callback allowing a {@link org.springframework.scheduling.TaskScheduler}
* and specific {@link org.springframework.scheduling.config.Task} instances
* to be registered against the given the {@link ScheduledTaskRegistrar}.
* @param taskRegistrar the registrar to be configured
*/
void configureTasks(ScheduledTaskRegistrar taskRegistrar);

7
spring-core/src/main/java/org/springframework/util/ConcurrencyThrottleSupport.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -69,7 +69,7 @@ public abstract class ConcurrencyThrottleSupport implements Serializable { @@ -69,7 +69,7 @@ public abstract class ConcurrencyThrottleSupport implements Serializable {
/**
* Set the maximum number of concurrent access attempts allowed.
* -1 indicates unbounded concurrency.
* The default of -1 indicates no concurrency limit at all.
* <p>In principle, this limit can be changed at runtime,
* although it is generally designed as a config time setting.
* <p>NOTE: Do not switch between -1 and any concrete limit at runtime,
@ -143,9 +143,10 @@ public abstract class ConcurrencyThrottleSupport implements Serializable { @@ -143,9 +143,10 @@ public abstract class ConcurrencyThrottleSupport implements Serializable {
*/
protected void afterAccess() {
if (this.concurrencyLimit >= 0) {
boolean debug = logger.isDebugEnabled();
synchronized (this.monitor) {
this.concurrencyCount--;
if (logger.isDebugEnabled()) {
if (debug) {
logger.debug("Returning from throttle at concurrency count " + this.concurrencyCount);
}
this.monitor.notify();

Loading…
Cancel
Save