try { MessageStoreStatistics recoveredStatistics; lockAsyncJobQueue(); indexLock.writeLock().lock(); try {
public int getMessageCount() throws IOException { try { lockAsyncJobQueue(); indexLock.readLock().lock(); try { return pageFile.tx().execute(new Transaction.CallableClosure<Integer, IOException>() { public Integer execute(Transaction tx) throws IOException { // Iterate through all index entries to get a count // of // messages in the destination. StoredDestination sd = getStoredDestination(dest, tx); int rc = 0; for (Iterator<Entry<Location, Long>> iterator = sd.locationIndex.iterator(tx); iterator .hasNext();) { iterator.next(); rc++; } return rc; } }); }finally { indexLock.readLock().unlock(); } } finally { unlockAsyncJobQueue(); } }
@Override public void setBatch(MessageId identity) throws IOException { try { final String key = identity.toString(); lockAsyncJobQueue(); // Hopefully one day the page file supports concurrent read // operations... but for now we must // externally synchronize... indexLock.writeLock().lock(); try { pageFile.tx().execute(new Transaction.Closure<IOException>() { public void execute(Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(dest, tx); Long location = sd.messageIdIndex.get(tx, key); if (location != null) { sd.orderIndex.setBatch(tx, location); } } }); }finally { indexLock.writeLock().unlock(); } } finally { unlockAsyncJobQueue(); } }
try { MessageStoreStatistics recoveredStatistics; lockAsyncJobQueue(); indexLock.writeLock().lock(); try {
try { MessageStoreStatistics recoveredStatistics; lockAsyncJobQueue(); indexLock.writeLock().lock(); try {
try { MessageStoreStatistics recoveredStatistics; lockAsyncJobQueue(); indexLock.writeLock().lock(); try {