public class JettyResourceFactory extends Object implements InitializingBean, DisposableBean
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.
| Constructor and Description |
|---|
JettyResourceFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, ApplicationContextAware etc. |
void |
destroy()
Invoked by the containing
BeanFactory on destruction of a bean. |
org.eclipse.jetty.io.ByteBufferPool |
getByteBufferPool()
Return the configured
ByteBufferPool. |
Executor |
getExecutor()
Return the configured
Executor. |
org.eclipse.jetty.util.thread.Scheduler |
getScheduler()
Return the configured
Scheduler. |
void |
setByteBufferPool(org.eclipse.jetty.io.ByteBufferPool byteBufferPool)
Configure the
ByteBufferPool to use. |
void |
setExecutor(Executor executor)
Configure the
Executor to use. |
void |
setScheduler(org.eclipse.jetty.util.thread.Scheduler scheduler)
Configure the
Scheduler to use. |
void |
setThreadPrefix(String threadPrefix)
Configure the thread prefix to initialize
QueuedThreadPool executor with. |
public void setExecutor(@Nullable Executor executor)
Executor to use.
By default, initialized with a QueuedThreadPool.
executor - the executor to usepublic void setByteBufferPool(@Nullable org.eclipse.jetty.io.ByteBufferPool byteBufferPool)
ByteBufferPool to use.
By default, initialized with a MappedByteBufferPool.
byteBufferPool - the ByteBuffer pool to usepublic void setScheduler(@Nullable org.eclipse.jetty.util.thread.Scheduler scheduler)
Scheduler to use.
By default, initialized with a ScheduledExecutorScheduler.
scheduler - the Scheduler to usepublic void setThreadPrefix(String threadPrefix)
QueuedThreadPool executor with. This
is used only when a Executor instance isn't
provided.
By default set to "jetty-http".
threadPrefix - the thread prefix to use@Nullable public org.eclipse.jetty.io.ByteBufferPool getByteBufferPool()
ByteBufferPool.@Nullable public org.eclipse.jetty.util.thread.Scheduler getScheduler()
Scheduler.public void afterPropertiesSet()
throws Exception
InitializingBeanBeanFactory after it has set all bean properties
and satisfied BeanFactoryAware, 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.
afterPropertiesSet in interface InitializingBeanException - in the event of misconfiguration (such as failure to set an
essential property) or if initialization fails for any other reasonpublic void destroy()
throws Exception
DisposableBeanBeanFactory on destruction of a bean.destroy in interface DisposableBeanException - in case of shutdown errors. Exceptions will get logged
but not rethrown to allow other beans to release their resources as well.