Java Code Examples for org.apache.rocketmq.common.protocol.body.ProcessQueueInfo#setTransactionMsgMinOffset()

The following examples show how to use org.apache.rocketmq.common.protocol.body.ProcessQueueInfo#setTransactionMsgMinOffset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessQueue.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
            info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));
        }

        if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
            info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
            info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
            info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 2
Source File: ProcessQueue.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
            info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));
        }

        if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
            info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
            info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
            info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 3
Source File: ProcessQueue.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * 获取消费者的运行时信息时,会被调用
 * @param info info
 */
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
            info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));
        }

        if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
            info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
            info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
            info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 4
Source File: ProcessQueue.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
        }

        if (!this.msgTreeMapTemp.isEmpty()) {
            info.setTransactionMsgMinOffset(this.msgTreeMapTemp.firstKey());
            info.setTransactionMsgMaxOffset(this.msgTreeMapTemp.lastKey());
            info.setTransactionMsgCount(this.msgTreeMapTemp.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 5
Source File: ProcessQueue.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
            info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));
        }

        if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
            info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
            info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
            info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 6
Source File: ProcessQueue.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
        }

        if (!this.msgTreeMapTemp.isEmpty()) {
            info.setTransactionMsgMinOffset(this.msgTreeMapTemp.firstKey());
            info.setTransactionMsgMaxOffset(this.msgTreeMapTemp.lastKey());
            info.setTransactionMsgCount(this.msgTreeMapTemp.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 7
Source File: ProcessQueue.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
        }

        if (!this.msgTreeMapTemp.isEmpty()) {
            info.setTransactionMsgMinOffset(this.msgTreeMapTemp.firstKey());
            info.setTransactionMsgMaxOffset(this.msgTreeMapTemp.lastKey());
            info.setTransactionMsgCount(this.msgTreeMapTemp.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}
 
Example 8
Source File: ProcessQueue.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void fillProcessQueueInfo(final ProcessQueueInfo info) {
    try {
        this.lockTreeMap.readLock().lockInterruptibly();

        if (!this.msgTreeMap.isEmpty()) {
            info.setCachedMsgMinOffset(this.msgTreeMap.firstKey());
            info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey());
            info.setCachedMsgCount(this.msgTreeMap.size());
            info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024)));
        }

        if (!this.consumingMsgOrderlyTreeMap.isEmpty()) {
            info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey());
            info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey());
            info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size());
        }

        info.setLocked(this.locked);
        info.setTryUnlockTimes(this.tryUnlockTimes.get());
        info.setLastLockTimestamp(this.lastLockTimestamp);

        info.setDroped(this.dropped);
        info.setLastPullTimestamp(this.lastPullTimestamp);
        info.setLastConsumeTimestamp(this.lastConsumeTimestamp);
    } catch (Exception e) {
    } finally {
        this.lockTreeMap.readLock().unlock();
    }
}