public class JettyResourceFactory extends java.lang.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.
Modifier and Type | Field and Description |
---|---|
private ByteBufferPool |
byteBufferPool |
private java.util.concurrent.Executor |
executor |
private Scheduler |
scheduler |
private java.lang.String |
threadPrefix |
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. |
ByteBufferPool |
getByteBufferPool()
Return the configured
ByteBufferPool . |
java.util.concurrent.Executor |
getExecutor()
Return the configured
Executor . |
Scheduler |
getScheduler()
Return the configured
Scheduler . |
void |
setByteBufferPool(ByteBufferPool byteBufferPool)
Configure the
ByteBufferPool to use. |
void |
setExecutor(java.util.concurrent.Executor executor)
Configure the
Executor to use. |
void |
setScheduler(Scheduler scheduler)
Configure the
Scheduler to use. |
void |
setThreadPrefix(java.lang.String threadPrefix)
Configure the thread prefix to initialize
QueuedThreadPool executor with. |
@Nullable private java.util.concurrent.Executor executor
@Nullable private ByteBufferPool byteBufferPool
@Nullable private Scheduler scheduler
private java.lang.String threadPrefix
public void setExecutor(@Nullable java.util.concurrent.Executor executor)
Executor
to use.
By default, initialized with a QueuedThreadPool
.
executor
- the executor to usepublic void setByteBufferPool(@Nullable ByteBufferPool byteBufferPool)
ByteBufferPool
to use.
By default, initialized with a MappedByteBufferPool
.
byteBufferPool
- the ByteBuffer
pool to usepublic void setScheduler(@Nullable Scheduler scheduler)
Scheduler
to use.
By default, initialized with a ScheduledExecutorScheduler
.
scheduler
- the Scheduler
to usepublic void setThreadPrefix(java.lang.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 java.util.concurrent.Executor getExecutor()
Executor
.@Nullable public ByteBufferPool getByteBufferPool()
ByteBufferPool
.@Nullable public Scheduler getScheduler()
Scheduler
.public void afterPropertiesSet() throws java.lang.Exception
InitializingBean
BeanFactory
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 InitializingBean
java.lang.Exception
- in the event of misconfiguration (such as failure to set an
essential property) or if initialization fails for any other reasonpublic void destroy() throws java.lang.Exception
DisposableBean
BeanFactory
on destruction of a bean.destroy
in interface DisposableBean
java.lang.Exception
- in case of shutdown errors. Exceptions will get logged
but not rethrown to allow other beans to release their resources as well.