当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationEventMulticaster类代码示例

本文整理汇总了Java中org.springframework.context.event.ApplicationEventMulticaster的典型用法代码示例。如果您正苦于以下问题:Java ApplicationEventMulticaster类的具体用法?Java ApplicationEventMulticaster怎么用?Java ApplicationEventMulticaster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationEventMulticaster类属于org.springframework.context.event包,在下文中一共展示了ApplicationEventMulticaster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * Initialize the ApplicationEventMulticaster.
 * Uses SimpleApplicationEventMulticaster if none defined in the context.
 * @see org.springframework.context.event.SimpleApplicationEventMulticaster
 */
protected void initApplicationEventMulticaster() {
	ConfigurableListableBeanFactory beanFactory = getBeanFactory();
	if (beanFactory.containsLocalBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)) {
		this.applicationEventMulticaster =
				beanFactory.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMulticaster.class);
		if (logger.isDebugEnabled()) {
			logger.debug("Using ApplicationEventMulticaster [" + this.applicationEventMulticaster + "]");
		}
	}
	else {
		this.applicationEventMulticaster = new SimpleApplicationEventMulticaster(beanFactory);
		beanFactory.registerSingleton(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, this.applicationEventMulticaster);
		if (logger.isDebugEnabled()) {
			logger.debug("Unable to locate ApplicationEventMulticaster with name '" +
					APPLICATION_EVENT_MULTICASTER_BEAN_NAME +
					"': using default [" + this.applicationEventMulticaster + "]");
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:AbstractApplicationContext.java

示例2: getApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
private synchronized ApplicationEventMulticaster getApplicationEventMulticaster()
{
  try
  {
    Field field = DataStore.class.getDeclaredField("mainContext");
    field.setAccessible(true);
    AbstractApplicationContext ctx = (AbstractApplicationContext) field.get(DataStore.getInstance());
    if (ctx == null)
      return null;
    Method m = AbstractApplicationContext.class.getDeclaredMethod("getApplicationEventMulticaster");
    m.setAccessible(true);
    ApplicationEventMulticaster eventCaster = (ApplicationEventMulticaster) m.invoke(ctx);
    field.setAccessible(false);
    m.setAccessible(false);
    return eventCaster;
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:iisi-nj,项目名称:GemFireLite,代码行数:23,代码来源:ApplicationListenerRegistry.java

示例3: createEditor

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
private Editor createEditor(){
	Object o = BeanUtils.instantiateClass(editorClass);
	Assert.isTrue((o instanceof Editor), "Editor class '"+
		editorClass + "' was instantiated but is not an Editor");
	Editor editor = (Editor)o;
	editor.setDescriptor(this);
	ApplicationEventMulticaster multicaster = getApplicationEventMulticaster();
	if(editor instanceof ApplicationListener &&  multicaster != null){
		multicaster.addApplicationListener((ApplicationListener)editor);
	}
	if(editorProperties != null){
		BeanWrapper wrapper = new BeanWrapperImpl(editor);
		wrapper.setPropertyValues(editorProperties);
	}
	if(editor instanceof InitializingBean){
		 try {
			 ((InitializingBean)editor).afterPropertiesSet();
         }
         catch (Exception e) {
             throw new BeanInitializationException("Problem running on " + editor, e);
         }
	}
	return editor;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:25,代码来源:EditorDescriptor.java

示例4: simpleApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
@Bean(name = "applicationEventMulticaster")
public ApplicationEventMulticaster simpleApplicationEventMulticaster() {
    SimpleApplicationEventMulticaster eventMulticaster = new SimpleApplicationEventMulticaster();

    taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setThreadNamePrefix("asyncEventExecutor-");
    taskExecutor.setCorePoolSize(4);
    taskExecutor.initialize();

    eventMulticaster.setTaskExecutor(taskExecutor);
    return eventMulticaster;
}
 
开发者ID:jeperon,项目名称:freqtrade-java,代码行数:13,代码来源:FreqTradeConfiguration.java

示例5: publishEvent

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
@Override
public void publishEvent(ApplicationEvent event)
{
    Assert.notNull(event, "Event must not be null");
    if (logger.isTraceEnabled())
    {
        logger.trace("Publishing event in " + getDisplayName() + ": " + event);
    }
    ((ApplicationEventMulticaster) getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)).multicastEvent(event);

    if (!(getParent() == null || event instanceof ContextRefreshedEvent || event instanceof ContextClosedEvent))
    {
        getParent().publishEvent(event);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:ChildApplicationContextFactory.java

示例6: getApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * Return the internal ApplicationEventMulticaster used by the context.
 * @return the internal ApplicationEventMulticaster (never {@code null})
 * @throws IllegalStateException if the context has not been initialized yet
 */
ApplicationEventMulticaster getApplicationEventMulticaster() throws IllegalStateException {
	if (this.applicationEventMulticaster == null) {
		throw new IllegalStateException("ApplicationEventMulticaster not initialized - " +
				"call 'refresh' before multicasting events via the context: " + this);
	}
	return this.applicationEventMulticaster;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AbstractApplicationContext.java

示例7: postProcessBeforeDestruction

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) {
	if (bean instanceof ApplicationListener) {
		ApplicationEventMulticaster multicaster = this.applicationContext.getApplicationEventMulticaster();
		multicaster.removeApplicationListener((ApplicationListener<?>) bean);
		multicaster.removeApplicationListenerBean(beanName);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:PostProcessorRegistrationDelegate.java

示例8: simpleApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
@Bean(name = "applicationEventMulticaster")
public ApplicationEventMulticaster simpleApplicationEventMulticaster() {
    multicasterExecutor.initialize();
    SimpleApplicationEventMulticaster eventMulticaster = new SimpleApplicationEventMulticaster();
    eventMulticaster.setTaskExecutor(multicasterExecutor);
    return eventMulticaster;
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:8,代码来源:AppConfig.java

示例9: init

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
@Before
public void init() throws Throwable {
    stubDemo();

    pluginDao.refresh();

    initGit();

    if (Files.exists(Paths.get(gitWorkspace.toString(), "plugin_cache.json"))) {
        Files.delete(Paths.get(gitWorkspace.toString(), "plugin_cache.json"));
    }

    applicationEventMulticaster = (ApplicationEventMulticaster) applicationContext
        .getBean(AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME);
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:16,代码来源:PluginServiceTest.java

示例10: MetacatApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param asyncEventMulticaster The asynchronous event multicaster to use
 */
public MetacatApplicationEventMulticaster(
    @Nonnull @NonNull final ApplicationEventMulticaster asyncEventMulticaster
) {
    super();
    this.asyncEventMulticaster = asyncEventMulticaster;
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:12,代码来源:MetacatApplicationEventMulticaster.java

示例11: applicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * The application event multicaster to use.
 *
 * @param asyncEventMulticaster The asynchronous event publisher
 * @return The application event multicaster to use.
 */
@Bean
public MetacatApplicationEventMulticaster applicationEventMulticaster(
    final ApplicationEventMulticaster asyncEventMulticaster
) {
    return new MetacatApplicationEventMulticaster(asyncEventMulticaster);
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:13,代码来源:CommonServerConfig.java

示例12: asyncEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * A multicast (async) event publisher to replace the synchronous one used by Spring via the ApplicationContext.
 *
 * @param taskExecutor The task executor to use
 * @return The application event multicaster to use
 */
@Bean
public ApplicationEventMulticaster asyncEventMulticaster(final TaskExecutor taskExecutor) {
    final SimpleApplicationEventMulticaster applicationEventMulticaster = new SimpleApplicationEventMulticaster();
    applicationEventMulticaster.setTaskExecutor(taskExecutor);
    return applicationEventMulticaster;
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:13,代码来源:CommonServerConfig.java

示例13: applicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * Server internal event publisher that allows parallel event processing if
 * the event listener is marked as so.
 *
 * @return publisher bean
 */
@Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
public ApplicationEventMulticaster applicationEventMulticaster() {
    final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher(
            tenantAware, applicationEventFilter());
    simpleApplicationEventMulticaster.setTaskExecutor(executor);
    return simpleApplicationEventMulticaster;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:14,代码来源:EventPublisherAutoConfiguration.java

示例14: initApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
/**
 * 修改特定上下文的Event Multicaster的默认实现
 *
 * @param context 被修改的上下文
 */
public static void initApplicationEventMulticaster(GenericApplicationContext context) {
    ApplicationEventMulticaster multicaster;
    ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
    if (beanFactory.containsLocalBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)) {
        multicaster =
                beanFactory.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, ApplicationEventMulticaster.class);
    } else {
        multicaster = new SmartApplicationEventMulticaster(beanFactory);
        beanFactory.registerSingleton(APPLICATION_EVENT_MULTICASTER_BEAN_NAME, multicaster);
    }
    setApplicationEventMulticaster(context, multicaster);

}
 
开发者ID:Kadvin,项目名称:spring-component-framework,代码行数:19,代码来源:ContextUtils.java

示例15: setApplicationEventMulticaster

import org.springframework.context.event.ApplicationEventMulticaster; //导入依赖的package包/类
private static void setApplicationEventMulticaster(GenericApplicationContext context,
                                                     ApplicationEventMulticaster applicationEventMulticaster) {
    try {
        FieldUtils.writeField(context, "applicationEventMulticaster", applicationEventMulticaster, true);
    } catch (IllegalAccessException e) {
        throw new ApplicationContextException("Can't hacking the spring context for applicationEventMulticaster", e);
    }
}
 
开发者ID:Kadvin,项目名称:spring-component-framework,代码行数:9,代码来源:ContextUtils.java


注:本文中的org.springframework.context.event.ApplicationEventMulticaster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。