From df76c06b86c2400068048cbc6e24bc92af3f9879 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期四, 14 十一月 2024 15:04:19 +0800
Subject: [PATCH] 完善升级演示代码,修改bug
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java | 40 ++++++++++++++++++----------------------
1 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
index 4725c66..30864ee 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java
@@ -13,15 +13,14 @@
public class PrefixedDataAvailableHandleImp implements PrefixedDataAvailableHandle {
- private static Logger log = LogManager.getLogger(PrefixedDataAvailableHandleImp.class) ;
+ private static final Logger log = LogManager.getLogger(PrefixedDataAvailableHandleImp.class) ;
/**
* 鍦ㄥ绾跨▼鐜涓繍琛�
* 鍒嗘瀽涓婄嚎鏁版嵁(缃戠粶杩炴帴鍚庣涓�鍖呮暟鎹�)鏄惁鍙幏寰�
- * @param in
- * @return
- * @throws Exception
+ * @param in IoBuffer
+ * @return PrefixedDataAvailableStatus
*/
public PrefixedDataAvailableStatus forOnLine(IoBuffer in){
int remain = in.remaining() ;
@@ -31,18 +30,18 @@
try{
PrefixedDataAvailableStatus pds = null ;
- HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ;
+ HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ;
- if(set == null || set.size() == 0){
+ if(set.size() == 0){
throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚瀹屾暣鎬ф鏌ョ被闆嗗悎涓虹┖銆�") ;
}
- int prority = ProtocolConstant.firstPriority ;
+ int priority = ProtocolConstant.firstPriority ;
while(true){
- Object[] objs = this.getClassObjAndAnnotationVo(prority, set) ;
+ Object[] objs = this.getClassObjAndAnnotationVo(priority, set) ;
PrefixedDataAvailable pda = (PrefixedDataAvailable)objs[0] ;
- if(pda == null && prority == ProtocolConstant.firstPriority){
- throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + prority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ;
+ if(pda == null && priority == ProtocolConstant.firstPriority){
+ throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + priority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ;
}else if(pda == null){
//璇存槑涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被闆嗗悎宸茬粡閬嶅巻瀹屼簡銆�
break ;
@@ -54,7 +53,7 @@
if(pds == null){
//璇存槑涓嶆槸瀵瑰簲鐨勫崗璁暟鎹紝闇�瑕佸彟澶栫殑鍗忚鏉ュ鐞嗕笂绾�
//寰幆缁х画
- prority++ ;
+ priority++ ;
}else{
//鍋滄寰幆锛岃繑鍥炵粨鏋�
break ;
@@ -80,11 +79,8 @@
/**
* 鍦ㄥ绾跨▼鐜涓繍琛�
* 鍒嗘瀽涓婅鏁版嵁(缃戠粶杩炴帴鍚庣浜�(鍖呭惈)鍖呬互鍚庢暟鎹�)鏄惁鍙幏寰�
- * @param in
- * @param clientProtocol
- * @param maxDataLength
- * @return
- * @throws Exception
+ * @param in IoBuffer
+ * @return PrefixedDataAvailableStatus
*/
public PrefixedDataAvailableStatus forUpData(IoBuffer in){
int remain = in.remaining() ;
@@ -94,9 +90,9 @@
try{
PrefixedDataAvailableStatus pds = null ;
- HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ;
+ HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ;
- if(set == null || set.size() == 0){
+ if(set.size() == 0){
throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚闆嗗悎涓虹┖銆�") ;
}
int prority = ProtocolConstant.firstPriority ;
@@ -144,10 +140,10 @@
/**
* 寰楀埌澶勭悊绫诲璞�
- * @param prority
- * @param set
- * @return
- * @throws Exception
+ * @param prority 浼樺厛绾�
+ * @param set 闆嗗悎
+ * @return Object[]
+ * @throws Exception 寮傚父
*/
private Object[] getClassObjAndAnnotationVo(int prority, Collection<AnnotationPrefixedDataAvailableVo> set) throws Exception{
PrefixedDataAvailable obj = null ;
--
Gitblit v1.8.0