List of usage examples for javax.ejb LockType READ
LockType READ
To view the source code for javax.ejb LockType READ.
Click Source Link
From source file:org.sofun.core.team.WireThemAll.java
@Timeout // @Schedule(minute = "*/2", hour = "*", persistent = false) @Lock(LockType.READ) public void check() throws Exception { if (!available) { return;// w w w . ja v a 2 s . c om } else { available = false; } try { List<Member> gambling_members = members.getGamblingMembers(); for (Member member : gambling_members) { float transferrable = members.getTransferableAmountFor(member); if (transferrable > 0.1) { SecureRandom randomGenerator = new SecureRandom(); MemberTransaction txn = new MemberTransactionImpl(new Date(), transferrable, CurrencyType.EURO, MemberTransactionType.WIRE_DEBIT); txn.setLabel(MemberTransactionType.WIRE_DEBIT); txn.setDebit(true); txn.setCredit(false); txn.setTransactionId(String.valueOf(randomGenerator.nextInt(1000000000))); member.addTransaction(txn); txn.setMember(member); log.info("Wiring amount=" + transferrable + " for member with email=" + member.getEmail()); } } } catch (Throwable t) { t.printStackTrace(); log.error(t.getMessage()); } finally { available = true; } }
From source file:org.sofun.platform.legigame.MemberLegigameStatusManager.java
@Schedule(minute = "15", hour = "3", persistent = false) @Lock(LockType.READ) public void syncMembers() { if (LOCK_SYNC_MEMBERS) { return;/*ww w .ja v a2s . com*/ } else { LOCK_SYNC_MEMBERS = true; } try { if (legigame != null) { log.debug("Syncing our players with remote Legigame."); legigame.syncMembers(offset, batchSize); if (offset + batchSize >= members.countMembers()) { log.debug("Offset back to zero (0)"); offset = 0; } else { offset += batchSize; } } } catch (LegigameException e) { log.error("An error occured while syncing with legigame " + "list :" + e.getMessage()); } finally { LOCK_SYNC_MEMBERS = false; } }
From source file:org.sofun.platform.legigame.MemberLegigameStatusManager.java
@Schedule(minute = "*/59", hour = "*", persistent = false) @Lock(LockType.READ) public void syncStatus() { if (LOCK_SYNC_STATUS) { return;//from w ww . j a v a 2s .c om } else { LOCK_SYNC_STATUS = true; } try { if (legigame != null) { log.debug("Check members status legigame side."); legigame.syncStatus(); } } catch (LegigameException e) { log.error("An error occured while syncing with legigame " + "list :" + e.getMessage()); } finally { LOCK_SYNC_STATUS = false; } }