From 07ba00bbc814f67050c46f028c5b56966d269c46 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 18 十月 2024 14:21:15 +0800
Subject: [PATCH] 处理树懒加载抖动,生命周期非编辑状态只读
---
Source/Common/PLTCommon/src/com/vci/common/util/IceProxyUtility.java | 47 +++++++++++++++++++++++++++++++++++++----------
1 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/Source/Common/PLTCommon/src/com/vci/common/util/IceProxyUtility.java b/Source/Common/PLTCommon/src/com/vci/common/util/IceProxyUtility.java
index 5d84bb4..58a16a5 100644
--- a/Source/Common/PLTCommon/src/com/vci/common/util/IceProxyUtility.java
+++ b/Source/Common/PLTCommon/src/com/vci/common/util/IceProxyUtility.java
@@ -3,9 +3,12 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
import com.vci.common.log.ServerWithLog4j;
import com.vci.common.resource.IceClientProperties;
import com.zeroc.Ice.ObjectPrx;
+import com.zeroc.Ice.Util;
/**
* <p>Title: </p>
@@ -18,6 +21,8 @@
*/
public abstract class IceProxyUtility {
+ private static final String locatorKey = "--Ice.Default.Locator";
+
private com.zeroc.Ice.Communicator _communicator = null;
protected IceProxyUtility() {
@@ -33,13 +38,20 @@
{
try
{
- _communicator = com.zeroc.Ice.Util.initialize(args);
- _communicator.getDefaultRouter();
+ String[] initParams = new String[0];
+ if (IceClientProperties.Endpoints().contains("/"))
+ initParams = new String[]{locatorKey + "=" + IceClientProperties.Endpoints()};
+
+ _communicator = Util.initialize(initParams);
+
+ //_communicator = com.zeroc.Ice.Util.initialize(args);
+ //_communicator.getDefaultRouter();
} catch (Exception e) {
ServerWithLog4j.logger.error("InitCommunicator Error", e);
throw e;
}
}
+
/**
* 鑾峰彇鏈嶅姟瀵硅薄浠g悊
@@ -47,25 +59,40 @@
* @return
* @throws Exception
*/
- public ObjectPrx getObjectByName(String name) throws Exception
+ public ObjectPrx getObjectByName(String name, String adapterRep) throws Exception
{
+ ObjectPrx prx = null;
try
{
- String proxyLocator = name + ":" + IceClientProperties.Endpoints();
-
- ObjectPrx prx = _communicator.stringToProxy(proxyLocator);
- Map<String, String> context = getCurUserContext();
- if (context != null) {
- return prx.ice_context(context);
+ String proxyLocator = name;
+ if (!IceClientProperties.Endpoints().contains("/")) {
+ proxyLocator = name + ":" + IceClientProperties.Endpoints();
} else {
- return prx;
+ proxyLocator = name + "@" + adapterRep;
}
+
+ prx = _communicator.stringToProxy(proxyLocator);
+
} catch (Exception e) {
e.printStackTrace();
throw e;
}
+
+ String[] ids = prx.ice_ids();
+
+ if (prx == null)
+ throw new Exception("Not Found ObjectPrx " + name);
+
+ Map<String, String> context = getCurUserContext();
+ if (context != null) {
+ return prx.ice_context(context);
+ } else {
+ return prx;
+ }
}
+
+
/**
* 鑾峰彇鏈嶅姟瀵硅薄浠g悊锛屽苟璁剧疆context淇℃伅
* @param name
--
Gitblit v1.9.3