Class JettyResourceFactory
java.lang.Object
org.springframework.http.client.reactive.JettyResourceFactory
- All Implemented Interfaces:
DisposableBean
,InitializingBean
Factory to manage Jetty resources, i.e.
Executor
, ByteBufferPool
and
Scheduler
, within the lifecycle of a Spring ApplicationContext
.
This factory implements InitializingBean
and DisposableBean
and is expected typically to be declared as a Spring-managed bean.
- Since:
- 5.1
- Author:
- Sebastien Deleuze
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.void
destroy()
Invoked by the containingBeanFactory
on destruction of a bean.org.eclipse.jetty.io.ByteBufferPool
Return the configuredByteBufferPool
.Return the configuredExecutor
.org.eclipse.jetty.util.thread.Scheduler
Return the configuredScheduler
.void
setByteBufferPool
(org.eclipse.jetty.io.ByteBufferPool byteBufferPool) Configure theByteBufferPool
to use.void
setExecutor
(Executor executor) Configure theExecutor
to use.void
setScheduler
(org.eclipse.jetty.util.thread.Scheduler scheduler) Configure theScheduler
to use.void
setThreadPrefix
(String threadPrefix) Configure the thread prefix to initializeQueuedThreadPool
executor with.
-
Constructor Details
-
JettyResourceFactory
public JettyResourceFactory()
-
-
Method Details
-
setExecutor
Configure theExecutor
to use.By default, initialized with a
QueuedThreadPool
.- Parameters:
executor
- the executor to use
-
setByteBufferPool
Configure theByteBufferPool
to use.By default, initialized with a
MappedByteBufferPool
.- Parameters:
byteBufferPool
- theByteBuffer
pool to use
-
setScheduler
Configure theScheduler
to use.By default, initialized with a
ScheduledExecutorScheduler
.- Parameters:
scheduler
- theScheduler
to use
-
setThreadPrefix
Configure the thread prefix to initializeQueuedThreadPool
executor with. This is used only when aExecutor
instance isn'tprovided
.By default set to "jetty-http".
- Parameters:
threadPrefix
- the thread prefix to use
-
getExecutor
Return the configuredExecutor
. -
getByteBufferPool
Return the configuredByteBufferPool
. -
getScheduler
Return the configuredScheduler
. -
afterPropertiesSet
Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
-
destroy
Description copied from interface:DisposableBean
Invoked by the containingBeanFactory
on destruction of a bean.- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
- in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources as well.
-