本文整理汇总了Java中org.springframework.context.ApplicationEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationEvent.getSource方法的具体用法?Java ApplicationEvent.getSource怎么用?Java ApplicationEvent.getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.ApplicationEvent
的用法示例。
在下文中一共展示了ApplicationEvent.getSource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onApplicationEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent event) {
// Once the context has been refreshed, we tell other interested beans
// about the existence of this content store
// (e.g. for monitoring purposes)
if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext) {
ApplicationContext context = ((ContextRefreshedEvent) event).getApplicationContext();
context.publishEvent(new ContentStoreCreatedEvent(this, Collections.<String, Serializable>emptyMap()));
}
}
示例2: onApplicationEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
public void onApplicationEvent(ApplicationEvent event)
{
// Once the context has been refreshed, we tell other interested beans about the existence of this content store
// (e.g. for monitoring purposes)
if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext)
{
publishEvent(((ContextRefreshedEvent) event).getApplicationContext(), Collections.<String, Serializable> emptyMap());
}
}
示例3: multicastEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
@Override
public void multicastEvent(ApplicationEvent event)
{
if (event instanceof ContextRefreshedEvent && event.getSource() == this.appContext)
{
this.isApplicationStarted = true;
for (ApplicationEvent queuedEvent : this.queuedEvents)
{
multicastEventInternal(queuedEvent);
}
this.queuedEvents.clear();
multicastEventInternal(event);
}
else if (event instanceof ContextClosedEvent && event.getSource() == this.appContext)
{
this.isApplicationStarted = false;
multicastEventInternal(event);
}
else if (this.isApplicationStarted)
{
multicastEventInternal(event);
}
else
{
this.queuedEvents.add(event);
}
}
示例4: onApplicationEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof AbstractAuthenticationFailureEvent) {
if (event.getSource() instanceof AbstractAuthenticationToken) {
AbstractAuthenticationToken token = (AbstractAuthenticationToken) event.getSource();
Object details = token.getDetails();
if (details instanceof WebAuthenticationDetails) {
LOG.info("Login failed from [" + ((WebAuthenticationDetails) details).getRemoteAddress() + "]");
}
}
}
}
示例5: onApplicationEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void onApplicationEvent(ApplicationEvent event)
{
if (this.autoStart && event instanceof ContextRefreshedEvent && event.getSource() == this.parent)
{
this.lock.writeLock().lock();
try
{
start(false, false);
}
catch (Exception e)
{
// Let's log and swallow auto-start exceptions so that they are non-fatal. This means that the system
// can hopefully be brought up to a level where its configuration can be edited and corrected
logger.error("Error auto-starting subsystem", e);
}
finally
{
this.lock.writeLock().unlock();
}
}
else if (event instanceof PropertyBackedBeanStartedEvent)
{
this.lock.writeLock().lock();
try
{
// If we aren't started, reinitialize so that we pick up state changes from the database
switch (this.runtimeState)
{
case PENDING_BROADCAST_START:
case STOPPED:
destroy(false);
// fall through
case UNINITIALIZED:
start(false, false);
}
}
finally
{
this.lock.writeLock().unlock();
}
}
else if (event instanceof PropertyBackedBeanStoppedEvent)
{
this.lock.writeLock().lock();
try
{
// Completely destroy the state so that it will have to be reinitialized should the bean be put back in
// to use by this node
destroy(false);
}
finally
{
this.lock.writeLock().unlock();
}
}
}
示例6: onApplicationEvent
import org.springframework.context.ApplicationEvent; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event.getSource() == this.source) {
onApplicationEventInternal(event);
}
}