public class ContainerRegistrar
extends java.lang.Object
implements org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanClassLoaderAware
ZooKeeperConnection
used by this
registrar is closed, that ephemeral node will be eagerly deleted. Since the ZooKeeperConnection
typically has
its lifecycle managed by Spring, that would be the normal behavior when the owning ApplicationContext
is
itself closed.Modifier and Type | Field and Description |
---|---|
protected DeploymentLoader |
deploymentLoader
Utility for loading streams and jobs (including deployment metadata).
|
Constructor and Description |
---|
ContainerRegistrar(ZooKeeperConnection zkConnection,
ContainerAttributes containerAttributes,
ContainerRepository containerRepository,
StreamFactory streamFactory,
JobFactory jobFactory,
ModuleOptionsMetadataResolver moduleOptionsMetadataResolver,
ModuleDeployer moduleDeployer)
Create an instance that will register the provided
ContainerAttributes whenever the underlying
ZooKeeperConnection is established. |
Modifier and Type | Method and Description |
---|---|
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanClassLoader(java.lang.ClassLoader classLoader) |
protected void |
undeployModule(java.lang.String streamName,
java.lang.String moduleType,
java.lang.String moduleLabel)
Undeploy the requested module.
|
protected final DeploymentLoader deploymentLoader
public ContainerRegistrar(ZooKeeperConnection zkConnection, ContainerAttributes containerAttributes, ContainerRepository containerRepository, StreamFactory streamFactory, JobFactory jobFactory, ModuleOptionsMetadataResolver moduleOptionsMetadataResolver, ModuleDeployer moduleDeployer)
ContainerAttributes
whenever the underlying
ZooKeeperConnection
is established. If that connection is already established at the time this instance
receives a ContextRefreshedEvent
, the attributes will be registered then. Otherwise, registration occurs
within a callback that is invoked for connected events as well as reconnected events.containerAttributes
- runtime and configured attributes for the containercontainerRepository
- repository for the containersstreamFactory
- factory to construct Stream
jobFactory
- factory to construct Job
moduleOptionsMetadataResolver
- resolver for module options metadatamoduleDeployer
- module deployerzkConnection
- ZooKeeper connectionprotected void undeployModule(java.lang.String streamName, java.lang.String moduleType, java.lang.String moduleLabel)
streamName
- name of the stream for the modulemoduleType
- module typemoduleLabel
- module labelpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
onApplicationEvent
in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
public void setBeanClassLoader(java.lang.ClassLoader classLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware