All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gnss.common.session.Session Maven / Gradle / Ivy

There is a newer version: 1.0.10
Show newest version
package com.gnss.common.session;

import com.gnss.common.proto.TerminalProto;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.tuple.MutablePair;

/**
 * 

Description: 通信会话

*

Company: www.gps-pro.cn

* * @author huangguangbin * @version 1.0.1 * @date 2018/11/1 */ public class Session { /** * 终端信息 */ @Getter @Setter private TerminalProto terminalInfo; /** * 手机号数组 */ @Getter @Setter private byte[] phoneNumArr; /** * 消息流水号范围 */ private final MutablePair msgFlowIdRange; /** * 当前消息流水号 */ private int currentMsgFlowId; public Session(Integer minMsgFlowId, Integer maxMsgFlowId, TerminalProto terminalInfo) { this.msgFlowIdRange = MutablePair.of(minMsgFlowId, maxMsgFlowId); this.terminalInfo = terminalInfo; } /** * 获取消息流水号,并设置下个消息流水号 * * @return 返回消息流水号 */ public int getNextMsgFlowId() { int msgFlowId = currentMsgFlowId; int minMsgFlowId = msgFlowIdRange.getLeft(); int maxMsgFlowId = msgFlowIdRange.getRight(); currentMsgFlowId = currentMsgFlowId >= maxMsgFlowId ? minMsgFlowId : currentMsgFlowId + 1; return msgFlowId; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy