• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Observer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: reloadConfigurationTimerEvent

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(EVENT_TYPE)
@Asynchronous
public void reloadConfigurationTimerEvent() {
    if (this.isActive.get()) {
        return;
    }

    if (!this.isActive.compareAndSet(false, true)) {
        return;
    }

    try {
        reloadConfiguration();
    } catch (Throwable ex) {
        log.error("Exception happened while reloading application configuration", ex);
    } finally {
        this.isActive.set(false);
    }
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:20,代码来源:OxTrustConfiguration.java


示例2: process

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(EVENT_TYPE)
@Asynchronous
public void process() {
    if (this.isActive.get()) {
        return;
    }

    if (!this.isActive.compareAndSet(false, true)) {
        return;
    }

    try {
        processInt();
    } finally {
        this.isActive.set(false);
    }
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:18,代码来源:LdapStatusTimer.java


示例3: reloadConfigurationTimerEvent

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(EVENT_TYPE)
@Asynchronous
public void reloadConfigurationTimerEvent() {
	if (this.isActive.get()) {
		return;
	}

	if (!this.isActive.compareAndSet(false, true)) {
		return;
	}

	try {
		reloadConfiguration();
	} catch (Throwable ex) {
		log.error("Exception happened while reloading application configuration", ex);
	} finally {
		this.isActive.set(false);
		this.lastFinishedTime = System.currentTimeMillis();
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:21,代码来源:AppInitializer.java


示例4: recreateCentralLdapEntryManager

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CENTRAL_CONFIGUARION_RELOAD_EVENT_TYPE)
  public void recreateCentralLdapEntryManager() {
  	// Backup current references to objects to allow shutdown properly
  	LdapEntryManager oldCentralLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_CENTRAL_ENTRY_MANAGER_NAME);

  	// Recreate components
if ((oxTrustConfiguration.getLdapCentralConfiguration() != null) && oxTrustConfiguration.getApplicationConfiguration().isUpdateApplianceStatus()) {
	createConnectionProvider(oxTrustConfiguration.getLdapCentralConfiguration(), "centralLdapConfiguration", "centralConnectionProvider");
} else {
   	Contexts.getApplicationContext().remove("centralConnectionProvider");
}

      // Destroy old components
  	Contexts.getApplicationContext().remove(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
  	
  	if (oldCentralLdapEntryManager != null) {
  		oldCentralLdapEntryManager.destroy();

      	log.debug("Destroyed {0}: {1}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, oldCentralLdapEntryManager);
  	}
  }
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:22,代码来源:AppInitializer.java


示例5: init

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.postInitialization")
public void init() {
	log.info("Initializing CacheRefreshTimer...");
	this.isActive = new AtomicBoolean(false);
	this.lastFinishedTime = System.currentTimeMillis();
	
	// Clean up previous Inum cache
	CacheRefreshConfiguration cacheRefreshConfiguration = oxTrustConfiguration.getCacheRefreshConfiguration();
	if (cacheRefreshConfiguration != null) {
		String snapshotFolder = cacheRefreshConfiguration.getSnapshotFolder();
		if (StringHelper.isNotEmpty(snapshotFolder)) {
			String inumCachePath = getInumCachePath(cacheRefreshConfiguration);
			objectSerializationService.cleanup(inumCachePath);
		}
	}

	// Schedule to start cache refresh every 1 minute
	Events.instance().raiseTimedEvent(OxTrustConstants.EVENT_CACHE_REFRESH_TIMER, new TimerSchedule(1 * 60 * 1000L, 1 * 60 * 1000L));
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:20,代码来源:CacheRefreshTimer.java


示例6: schedulePayment

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.example.quartz.test.scheduleAndSave")
@Transactional
public QuartzTriggerHandle schedulePayment(Payment payment) 
{ 
    payment = entityManager.merge(payment);
    
    log.error("[#0] Processing cron payment #1", System.currentTimeMillis(), payment.getId());
    if (payment.getActive()) {
        BigDecimal balance = payment.getAccount().adjustBalance(payment.getAmount().negate());
        log.error(":: balance is now #0", balance);
        payment.setLastPaid(new Date());

    }

    return null;
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:17,代码来源:TestPaymentProcessor.java


示例7: checkForMatchingCombinedTags

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(value = "checkForMatchingCombinedTags", create = false)
public boolean checkForMatchingCombinedTags() {
	for (final CombinedTag tag : combineOpponentBean.getOpponentTags()) {
		
		final Iterator<Combination> combinations = combinationsToTest.iterator();
		while (combinations.hasNext()) {
			final Combination combination = combinations.next();
			
			log.info("Comaring #0 and #1", combination.getCombinedTag(), tag);
			
			if (combination.getCombinedTag().equals(tag)) {
				score(combination, MatchType.DIRECT);
				
				combinations.remove();
				
				return true;
			}
		}
	}
	
	return false;
}
 
开发者ID:play4science,项目名称:gwap,代码行数:23,代码来源:CombinedTagBean.java


示例8: updateList

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("mit.betList.update")
public void updateList() {
	long start = System.currentTimeMillis();
	Query q = entityManager.createNamedQuery("bet.byPerson")
			.setParameter("person", person);
	betList = q.getResultList();
	paginationControl.setNumResults(betList.size());
	if (paginationControl.getNumPages() > 1) {
		q.setFirstResult(paginationControl.getFirstResult());
		q.setMaxResults(paginationControl.getResultsPerPage());
		betList = q.getResultList();
	}
	for (Bet bet : betList) {
		Resource resource = bet.getResource();
		if (resource instanceof Statement)
			((Statement) resource).getStatementTokens().size();
		if (bet.getCurrentMatch() == null || bet.getScore() == null)
			mitPokerScoring.updateScoreForBet(bet);
	}
	log.info("Created betList with #0 statements in #1ms",
			betList.size(), System.currentTimeMillis() - start);
	if (betList.size() > 0)
		selectedBet = betList.get(resultNumber);
}
 
开发者ID:play4science,项目名称:gwap,代码行数:25,代码来源:BetList.java


示例9: init

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.postInitialization")
public void init() {
    log.info("Initializing LdapStatusTimer");
    this.isActive = new AtomicBoolean(false);

    Events.instance().raiseTimedEvent(EVENT_TYPE, new TimerSchedule(DEFAULT_INTERVAL, DEFAULT_INTERVAL));
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:8,代码来源:LdapStatusTimer.java


示例10: init

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.postInitialization")
public void init() {
	// Schedule to run it every 120 seconds. First event will occur after 30
	// seconds
	Events.instance().raiseTimedEvent(OxTrustConstants.EVENT_METADATA_ENTITY_ID_UPDATE,
			new TimerSchedule(30 * 1000L, AppInitializer.CONNECTION_CHECKER_INTERVAL));
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:8,代码来源:EntityIDMonitoringService.java


示例11: initReloadTimer

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.postInitialization")
  public void initReloadTimer() {
this.isActive = new AtomicBoolean(false);
this.lastFinishedTime = System.currentTimeMillis();

Events.instance().raiseTimedEvent(EVENT_TYPE, new TimerSchedule(1 * 60 * 1000L, DEFAULT_INTERVAL * 1000L));
  }
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:8,代码来源:AppInitializer.java


示例12: recreateLdapEntryManager

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CONFIGUARION_RELOAD_EVENT_TYPE)
  public void recreateLdapEntryManager() {
  	// Backup current references to objects to allow shutdown properly
  	LdapEntryManager oldLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_ENTRY_MANAGER_NAME);

  	// Recreate components
createConnectionProvider(oxTrustConfiguration.getLdapConfiguration(), "localLdapConfiguration", "connectionProvider");

      // Destroy old components
  	Contexts.getApplicationContext().remove(LDAP_ENTRY_MANAGER_NAME);
  	oldLdapEntryManager.destroy();

  	log.debug("Destroyed {0}: {1}", LDAP_ENTRY_MANAGER_NAME, oldLdapEntryManager);
  }
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:15,代码来源:AppInitializer.java


示例13: process

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(OxTrustConstants.EVENT_CACHE_REFRESH_TIMER)
@Asynchronous
public void process() {
	if (this.isActive.get()) {
		log.debug("Another process is active");
		return;
	}

	CacheRefreshConfiguration cacheRefreshConfiguration = oxTrustConfiguration.getCacheRefreshConfiguration();

	if (!this.isActive.compareAndSet(false, true)) {
		log.debug("Failed to start process exclusively");
		return;
	}

	try {
		GluuAppliance currentAppliance = applianceService.getAppliance();
		if (!isStartCacheRefresh(cacheRefreshConfiguration, currentAppliance)) {
			log.debug("Starting conditions aren't reached");
			return;
		}

		processImpl(cacheRefreshConfiguration, currentAppliance);
		updateApplianceStatus(currentAppliance, System.currentTimeMillis());

		this.lastFinishedTime = System.currentTimeMillis();
	} catch (Throwable ex) {
		log.error("Exception happened while executing cache refresh synchronization", ex);
	} finally {
		log.debug("Allowing to run new process exclusively");
		this.isActive.set(false);
	}
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:34,代码来源:CacheRefreshTimer.java


示例14: observeTransactionSuccess

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.example.quartz.test.transactionSuccess")
@Transactional
public void observeTransactionSuccess(Payment payment)
{
    TransactionStatus.instance().setTransactionSucceded(true);
    TransactionStatus.instance().setId(payment.getId());
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:8,代码来源:TestPaymentProcessor.java


示例15: observeTransactionCompletion

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.example.quartz.test.transactionCompletion")
@Transactional
public void observeTransactionCompletion(Payment payment)
{
    TransactionStatus.instance().setTransactionCompleted(true);
    TransactionStatus.instance().setId(payment.getId());
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:8,代码来源:TestPaymentProcessor.java


示例16: checkAndAward

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer(Identity.EVENT_LOGIN_SUCCESSFUL)
public void checkAndAward() {
	resetCache();
	Badge b = getNextBestBadge();
	Badge lastBadge = null;
	while (b != lastBadge) {
		lastBadge = b;
		if (b.getWorth() <= 3) { // for location assignment
			if (getNrLocationAssignmentsForNextBadge() <= 0) {
				person = entityManager.find(Person.class, person.getId());
				person.getBadges().add(b);
				facesMessages.addFromResourceBundle("badge.reached");
				log.info("#0 reached next badge #1", person, b);
			}
		} else if (b.getWorth() == 4) {
			if (getNrBetsForNextBadge() <= 0) {
				person = entityManager.find(Person.class, person.getId());
				person.getBadges().add(b);
				facesMessages.addFromResourceBundle("badge.reached");
				log.info("#0 reached next badge #1", person, b);
			}
		} else if (b.getWorth() == 5) {
			HighscoreBean highscoreBean = (HighscoreBean) Component.getInstance("highscoreBean", true);
			List<HighscoreSet> highscores = highscoreBean.getHighscores();
			for (HighscoreSet highscoreSet : highscores) {
				if (highscoreSet.getGameType().getName().equals("mitRecognize")) {
					if (highscoreSet.getHighscoreAll().get(0).getPersonId().equals(person.getId())) {
						person.getBadges().add(b);
						facesMessages.addFromResourceBundle("badge.reached");
						log.info("#0 reached next badge #1", person, b);
					}
				}
			}
		}
		entityManager.flush();
		resetCache();
		b = getNextBestBadge();
	}
}
 
开发者ID:play4science,项目名称:gwap,代码行数:40,代码来源:BadgeBean.java


示例17: getBookings

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Factory
@Observer("bookingConfirmed")
public void getBookings()
{
   bookings = em.createQuery("select b from Booking b where b.user.username = :username order by b.checkinDate")
         .setParameter("username", user.getUsername())
         .getResultList();
}
 
开发者ID:windup,项目名称:windup,代码行数:9,代码来源:BookingListAction.java


示例18: initReloadTimer

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
@Observer("org.jboss.seam.postInitialization")
public void initReloadTimer() {
    final long delayBeforeFirstRun = 30 * 1000L;
    Events.instance().raiseTimedEvent(EVENT_TYPE, new TimerSchedule(delayBeforeFirstRun, DEFAULT_INTERVAL * 1000L));
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:6,代码来源:OxTrustConfiguration.java


示例19: clearOrganizationCache

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
/**
 * Remove organization from cache after receiving event that organization
 * were changed
 */
@Observer(OxTrustConstants.EVENT_CLEAR_ORGANIZATION)
public void clearOrganizationCache() throws Exception {
	log.debug("Removing organization from cache");
	cacheService.removeAll(OxTrustConstants.CACHE_APPLICATION_NAME);
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:10,代码来源:OrganizationService.java


示例20: clearAttributesCache

import org.jboss.seam.annotations.Observer; //导入依赖的package包/类
/**
 * Clear attributes cache after receiving event that attributes were changed
 */
@Observer(OxTrustConstants.EVENT_CLEAR_ATTRIBUTES)
public void clearAttributesCache() {
	log.debug("Removing attributes from cache");
	cacheService.removeAll(OxTrustConstants.CACHE_ATTRIBUTE_NAME);
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:9,代码来源:AttributeService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IEditingSupportRegistry类代码示例发布时间:2022-05-22
下一篇:
Java OpVars类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap