本文整理汇总了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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
}
示例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());
}
示例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());
}