@@ -50,11 +50,11 @@ public class ReactorResourceFactory implements InitializingBean, DisposableBean
50
50
@ SuppressWarnings ("deprecation" )
51
51
private Supplier <ConnectionProvider > connectionProviderSupplier = () -> ConnectionProvider .fixed ("webflux" , 500 );
52
52
53
- private Supplier <LoopResources > loopResourcesSupplier = () -> LoopResources .create ("webflux-http" );
54
-
55
53
@ Nullable
56
54
private ConnectionProvider connectionProvider ;
57
55
56
+ private Supplier <LoopResources > loopResourcesSupplier = () -> LoopResources .create ("webflux-http" );
57
+
58
58
@ Nullable
59
59
private LoopResources loopResources ;
60
60
@@ -88,29 +88,6 @@ public boolean isUseGlobalResources() {
88
88
return this .useGlobalResources ;
89
89
}
90
90
91
- /**
92
- * Configure the amount of time we'll wait before shutting down resources. If a task is
93
- * submitted during the {@code quietPeriod}, it is guaranteed to be accepted and the
94
- * {@code quietPeriod} will start over.
95
- * @since 5.2.4
96
- * @see #setShutdownTimeout(Duration)
97
- */
98
- public void setShutdownQuietPeriod (Duration shutdownQuietPeriod ) {
99
- Assert .notNull (shutdownQuietPeriod , "shutdownQuietPeriod should not be null" );
100
- this .shutdownQuietPeriod = shutdownQuietPeriod ;
101
- }
102
-
103
- /**
104
- * Configure the maximum amount of time to wait until the disposal of the underlying
105
- * resources regardless if a task was submitted during the {@code shutdownQuietPeriod}.
106
- * @since 5.2.4
107
- * @see #setShutdownTimeout(Duration)
108
- */
109
- public void setShutdownTimeout (Duration shutdownTimeout ) {
110
- Assert .notNull (shutdownTimeout , "shutdownQuietPeriod should not be null" );
111
- this .shutdownTimeout = shutdownTimeout ;
112
- }
113
-
114
91
/**
115
92
* Add a Consumer for configuring the global Reactor Netty resources on
116
93
* startup. When this option is used, {@link #setUseGlobalResources} is also
@@ -125,7 +102,7 @@ public void addGlobalResourcesConsumer(Consumer<HttpResources> consumer) {
125
102
}
126
103
127
104
/**
128
- * Use this option when you don't want to participate in global resources and
105
+ * Use this when you don't want to participate in global resources and
129
106
* you want to customize the creation of the managed {@code ConnectionProvider}.
130
107
* <p>By default, {@code ConnectionProvider.elastic("http")} is used.
131
108
* <p>Note that this option is ignored if {@code userGlobalResources=false} or
@@ -137,19 +114,7 @@ public void setConnectionProviderSupplier(Supplier<ConnectionProvider> supplier)
137
114
}
138
115
139
116
/**
140
- * Use this option when you don't want to participate in global resources and
141
- * you want to customize the creation of the managed {@code LoopResources}.
142
- * <p>By default, {@code LoopResources.create("reactor-http")} is used.
143
- * <p>Note that this option is ignored if {@code userGlobalResources=false} or
144
- * {@link #setLoopResources(LoopResources)} is set.
145
- * @param supplier the supplier to use
146
- */
147
- public void setLoopResourcesSupplier (Supplier <LoopResources > supplier ) {
148
- this .loopResourcesSupplier = supplier ;
149
- }
150
-
151
- /**
152
- * Use this option when you want to provide an externally managed
117
+ * Use this when you want to provide an externally managed
153
118
* {@link ConnectionProvider} instance.
154
119
* @param connectionProvider the connection provider to use as is
155
120
*/
@@ -165,6 +130,18 @@ public ConnectionProvider getConnectionProvider() {
165
130
return this .connectionProvider ;
166
131
}
167
132
133
+ /**
134
+ * Use this when you don't want to participate in global resources and
135
+ * you want to customize the creation of the managed {@code LoopResources}.
136
+ * <p>By default, {@code LoopResources.create("reactor-http")} is used.
137
+ * <p>Note that this option is ignored if {@code userGlobalResources=false} or
138
+ * {@link #setLoopResources(LoopResources)} is set.
139
+ * @param supplier the supplier to use
140
+ */
141
+ public void setLoopResourcesSupplier (Supplier <LoopResources > supplier ) {
142
+ this .loopResourcesSupplier = supplier ;
143
+ }
144
+
168
145
/**
169
146
* Use this option when you want to provide an externally managed
170
147
* {@link LoopResources} instance.
@@ -182,6 +159,40 @@ public LoopResources getLoopResources() {
182
159
return this .loopResources ;
183
160
}
184
161
162
+ /**
163
+ * Configure the amount of time we'll wait before shutting down resources.
164
+ * If a task is submitted during the {@code quietPeriod}, it is guaranteed
165
+ * to be accepted and the {@code quietPeriod} will start over.
166
+ * <p>By default, this is set to
167
+ * {@link LoopResources#DEFAULT_SHUTDOWN_QUIET_PERIOD} which is 2 seconds but
168
+ * can also be overridden with the system property
169
+ * {@link reactor.netty.ReactorNetty#SHUTDOWN_QUIET_PERIOD
170
+ * ReactorNetty.SHUTDOWN_QUIET_PERIOD}.
171
+ * @since 5.2.4
172
+ * @see #setShutdownTimeout(Duration)
173
+ */
174
+ public void setShutdownQuietPeriod (Duration shutdownQuietPeriod ) {
175
+ Assert .notNull (shutdownQuietPeriod , "shutdownQuietPeriod should not be null" );
176
+ this .shutdownQuietPeriod = shutdownQuietPeriod ;
177
+ }
178
+
179
+ /**
180
+ * Configure the maximum amount of time to wait until the disposal of the
181
+ * underlying resources regardless if a task was submitted during the
182
+ * {@code shutdownQuietPeriod}.
183
+ * <p>By default, this is set to
184
+ * {@link LoopResources#DEFAULT_SHUTDOWN_TIMEOUT} which is 15 seconds but
185
+ * can also be overridden with the system property
186
+ * {@link reactor.netty.ReactorNetty#SHUTDOWN_TIMEOUT
187
+ * ReactorNetty.SHUTDOWN_TIMEOUT}.
188
+ * @since 5.2.4
189
+ * @see #setShutdownQuietPeriod(Duration)
190
+ */
191
+ public void setShutdownTimeout (Duration shutdownTimeout ) {
192
+ Assert .notNull (shutdownTimeout , "shutdownQuietPeriod should not be null" );
193
+ this .shutdownTimeout = shutdownTimeout ;
194
+ }
195
+
185
196
186
197
@ Override
187
198
public void afterPropertiesSet () {
@@ -210,7 +221,8 @@ public void afterPropertiesSet() {
210
221
@ Override
211
222
public void destroy () {
212
223
if (this .useGlobalResources ) {
213
- HttpResources .disposeLoopsAndConnectionsLater (this .shutdownQuietPeriod , this .shutdownTimeout ).block ();
224
+ HttpResources .disposeLoopsAndConnectionsLater (
225
+ this .shutdownQuietPeriod , this .shutdownTimeout ).block ();
214
226
}
215
227
else {
216
228
try {
0 commit comments