类 ReactorResourceFactory
- 所有已实现的接口:
cn.taketoday.beans.factory.DisposableBean,cn.taketoday.beans.factory.InitializingBean,cn.taketoday.context.Lifecycle
LoopResources for
event loop threads, and ConnectionProvider for the connection pool,
within the lifecycle of a Infra ApplicationContext.
This factory implements InitializingBean, DisposableBean
and Lifecycle and is expected typically to be declared as a
Infra-managed bean.
Notice that after a Lifecycle stop/restart, new instances of
the configured LoopResources and ConnectionProvider are
created, so any references to those should be updated.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Brian Clozel, Harry Yang
-
字段概要
字段修饰符和类型字段说明private reactor.netty.resources.ConnectionProviderprivate Supplier<reactor.netty.resources.ConnectionProvider>private Consumer<reactor.netty.http.HttpResources>private final Objectprivate reactor.netty.resources.LoopResourcesprivate Supplier<reactor.netty.resources.LoopResources>private booleanprivate booleanprivate booleanprivate Durationprivate Durationprivate boolean -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddGlobalResourcesConsumer(Consumer<reactor.netty.http.HttpResources> consumer) Add a Consumer for configuring the global Reactor Netty resources on startup.voidvoiddestroy()reactor.netty.resources.ConnectionProviderReturn the configuredConnectionProvider.reactor.netty.resources.LoopResourcesReturn the configuredLoopResources.booleanbooleanWhether this factory exposes the globalHttpResourcesholder.voidsetConnectionProvider(reactor.netty.resources.ConnectionProvider connectionProvider) Use this when you want to provide an externally managedConnectionProviderinstance.voidsetConnectionProviderSupplier(Supplier<reactor.netty.resources.ConnectionProvider> supplier) Use this when you don't want to participate in global resources and you want to customize the creation of the managedConnectionProvider.voidsetLoopResources(reactor.netty.resources.LoopResources loopResources) Use this option when you want to provide an externally managedLoopResourcesinstance.voidsetLoopResourcesSupplier(Supplier<reactor.netty.resources.LoopResources> supplier) Use this when you don't want to participate in global resources and you want to customize the creation of the managedLoopResources.voidsetShutdownQuietPeriod(Duration shutdownQuietPeriod) Configure the amount of time we'll wait before shutting down resources.voidsetShutdownTimeout(Duration shutdownTimeout) Configure the maximum amount of time to wait until the disposal of the underlying resources regardless if a task was submitted during theshutdownQuietPeriod.voidsetUseGlobalResources(boolean useGlobalResources) Whether to use global Reactor Netty resources viaHttpResources.voidstart()voidstop()
-
字段详细资料
-
useGlobalResources
private boolean useGlobalResources -
loopResources
@Nullable private reactor.netty.resources.LoopResources loopResources -
connectionProvider
@Nullable private reactor.netty.resources.ConnectionProvider connectionProvider -
globalResourcesConsumer
-
loopResourcesSupplier
-
connectionProviderSupplier
-
manageLoopResources
private boolean manageLoopResources -
manageConnectionProvider
private boolean manageConnectionProvider -
shutdownTimeout
-
shutdownQuietPeriod
-
running
private volatile boolean running -
lifecycleMonitor
-
-
构造器详细资料
-
ReactorResourceFactory
public ReactorResourceFactory()
-
-
方法详细资料
-
setUseGlobalResources
public void setUseGlobalResources(boolean useGlobalResources) Whether to use global Reactor Netty resources viaHttpResources.Default is "true" in which case this factory initializes and stops the global Reactor Netty resources within
ApplicationContextlifecycle. If set to "false" the factory manages its resources independent of the global ones.- 参数:
useGlobalResources- whether to expose and manage the global resources- 另请参阅:
-
isUseGlobalResources
public boolean isUseGlobalResources()Whether this factory exposes the globalHttpResourcesholder. -
addGlobalResourcesConsumer
Add a Consumer for configuring the global Reactor Netty resources on startup. When this option is used,setUseGlobalResources(boolean)is also enabled.- 参数:
consumer- the consumer to apply- 另请参阅:
-
setConnectionProviderSupplier
public void setConnectionProviderSupplier(Supplier<reactor.netty.resources.ConnectionProvider> supplier) Use this when you don't want to participate in global resources and you want to customize the creation of the managedConnectionProvider.By default,
ConnectionProvider.elastic("http")is used.Note that this option is ignored if
userGlobalResources=falseorsetConnectionProvider(ConnectionProvider)is set.- 参数:
supplier- the supplier to use
-
setConnectionProvider
public void setConnectionProvider(reactor.netty.resources.ConnectionProvider connectionProvider) Use this when you want to provide an externally managedConnectionProviderinstance.- 参数:
connectionProvider- the connection provider to use as is
-
getConnectionProvider
public reactor.netty.resources.ConnectionProvider getConnectionProvider()Return the configuredConnectionProvider. -
setLoopResourcesSupplier
Use this when you don't want to participate in global resources and you want to customize the creation of the managedLoopResources.By default,
LoopResources.create("reactor-http")is used.Note that this option is ignored if
userGlobalResources=falseorsetLoopResources(LoopResources)is set.- 参数:
supplier- the supplier to use
-
setLoopResources
public void setLoopResources(reactor.netty.resources.LoopResources loopResources) Use this option when you want to provide an externally managedLoopResourcesinstance.- 参数:
loopResources- the loop resources to use as is
-
getLoopResources
public reactor.netty.resources.LoopResources getLoopResources()Return the configuredLoopResources. -
setShutdownQuietPeriod
Configure the amount of time we'll wait before shutting down resources. If a task is submitted during theshutdownQuietPeriod, it is guaranteed to be accepted and theshutdownQuietPeriodwill start over.By default, this is set to
LoopResources.DEFAULT_SHUTDOWN_QUIET_PERIODwhich is 2 seconds but can also be overridden with the system propertyReactorNetty.SHUTDOWN_QUIET_PERIOD. -
setShutdownTimeout
Configure the maximum amount of time to wait until the disposal of the underlying resources regardless if a task was submitted during theshutdownQuietPeriod.By default, this is set to
LoopResources.DEFAULT_SHUTDOWN_TIMEOUTwhich is 15 seconds but can also be overridden with the system propertyReactorNetty.SHUTDOWN_TIMEOUT. -
afterPropertiesSet
public void afterPropertiesSet()- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean
-
destroy
public void destroy()- 指定者:
destroy在接口中cn.taketoday.beans.factory.DisposableBean
-
start
public void start()- 指定者:
start在接口中cn.taketoday.context.Lifecycle
-
stop
public void stop()- 指定者:
stop在接口中cn.taketoday.context.Lifecycle
-
isRunning
public boolean isRunning()- 指定者:
isRunning在接口中cn.taketoday.context.Lifecycle
-