⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transactionid.java

📁 JAVA解析MSNP15协议
💻 JAVA
字号:
package jm.framework.msn.entity;

/**
 * 队列编号
 * 梦界家园MSNP15
 * @author ISHome
 * @since 0.5.0.1
 * @version 0.1
 */
public class TransactionId {
	private static TransactionId instance = null;
		
	public static TransactionId getInstance(){
		if (instance == null){
			instance = new TransactionId();
		}
		return instance;
	}

    private int trId = 0;

    /**
     * 获得队列编号
     * @return
     */
    public synchronized int nextTransactionId() {
        trId++;
        if (trId < 0) //Bigger than Integer.MAX_VALUE
            trId = 1;
        return trId;
    }

    @Override
	public String toString() {
        return ""+trId;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -