Class JettyResourceFactory
- java.lang.Object
- org.springframework.http.client.reactive.JettyResourceFactory
- All Implemented Interfaces:
DisposableBean,InitializingBean
public class JettyResourceFactory extends Object implements InitializingBean, DisposableBean
Factory to manage Jetty resources, i.e.Executor,ByteBufferPoolandScheduler, within the lifecycle of a SpringApplicationContext.This factory implements
InitializingBeanandDisposableBeanand is expected typically to be declared as a Spring-managed bean.- Since:
- 5.1
- Author:
- Sebastien Deleuze
Constructor Summary
Constructors Constructor Description JettyResourceFactory()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.org.eclipse.jetty.io.ByteBufferPoolgetByteBufferPool()Return the configuredByteBufferPool.ExecutorgetExecutor()Return the configuredExecutor.org.eclipse.jetty.util.thread.SchedulergetScheduler()Return the configuredScheduler.voidsetByteBufferPool(org.eclipse.jetty.io.ByteBufferPool byteBufferPool)Configure theByteBufferPoolto use.voidsetExecutor(Executor executor)Configure theExecutorto use.voidsetScheduler(org.eclipse.jetty.util.thread.Scheduler scheduler)Configure theSchedulerto use.voidsetThreadPrefix(String threadPrefix)Configure the thread prefix to initializeQueuedThreadPoolexecutor with.
Constructor Detail
JettyResourceFactory
public JettyResourceFactory()
Method Detail
setExecutor
public void setExecutor(@Nullable Executor executor)
Configure theExecutorto use.By default, initialized with a
QueuedThreadPool.- Parameters:
executor- the executor to use
setByteBufferPool
public void setByteBufferPool(@Nullable org.eclipse.jetty.io.ByteBufferPool byteBufferPool)
Configure theByteBufferPoolto use.By default, initialized with a
MappedByteBufferPool.- Parameters:
byteBufferPool- theByteBufferpool to use
setScheduler
public void setScheduler(@Nullable org.eclipse.jetty.util.thread.Scheduler scheduler)
Configure theSchedulerto use.By default, initialized with a
ScheduledExecutorScheduler.- Parameters:
scheduler- theSchedulerto use
setThreadPrefix
public void setThreadPrefix(String threadPrefix)
Configure the thread prefix to initializeQueuedThreadPoolexecutor with. This is used only when aExecutorinstance isn'tprovided.By default set to "jetty-http".
- Parameters:
threadPrefix- the thread prefix to use
getExecutor
@Nullable public Executor getExecutor()
Return the configuredExecutor.
getByteBufferPool
@Nullable public org.eclipse.jetty.io.ByteBufferPool getByteBufferPool()
Return the configuredByteBufferPool.
getScheduler
@Nullable public org.eclipse.jetty.util.thread.Scheduler getScheduler()
Return the configuredScheduler.
afterPropertiesSet
public void afterPropertiesSet() throws Exception
Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.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:
afterPropertiesSetin 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
public void destroy() throws Exception
Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
destroyin 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.