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


Java Observer类代码示例

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


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


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