读写次数更新
This commit is contained in:
@@ -118,8 +118,19 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
while (true) {
|
while (true) {
|
||||||
// System.out.println("label97");
|
// System.out.println("label97");
|
||||||
long begin = System.currentTimeMillis();
|
long begin = System.currentTimeMillis();
|
||||||
Map<Item, ItemState> itemStatus =
|
Map<Item, ItemState> itemStatus =null;
|
||||||
group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
|
||||||
|
try{
|
||||||
|
itemStatus=group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||||
|
}catch (Exception e){
|
||||||
|
try{
|
||||||
|
itemStatus=group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||||
|
}catch (Exception e2){
|
||||||
|
itemStatus=group.read(true, (Item[]) itemsMap.values().toArray(new Item[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO 读完释放server可行否?
|
//TODO 读完释放server可行否?
|
||||||
|
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package org.nl.acs.opc;
|
package org.nl.acs.opc;
|
||||||
|
|
||||||
public class OpcStartTag {
|
public class OpcStartTag {
|
||||||
public static boolean is_run = true;
|
public static boolean is_run = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,17 @@ public class OpcUtl {
|
|||||||
|
|
||||||
public static void writeValue(Group group, WriteRequest... requests) throws WDKException {
|
public static void writeValue(Group group, WriteRequest... requests) throws WDKException {
|
||||||
try {
|
try {
|
||||||
Map<Item, Integer> e = group.write(requests);
|
Map<Item, Integer> e=null;
|
||||||
|
try{
|
||||||
|
group.write(requests);
|
||||||
|
}catch (Exception e1){
|
||||||
|
try{
|
||||||
|
e= group.write(requests);
|
||||||
|
}catch (Exception e2){
|
||||||
|
e= group.write(requests);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean is_success = true;
|
boolean is_success = true;
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
Iterator arg4 = e.keySet().iterator();
|
Iterator arg4 = e.keySet().iterator();
|
||||||
@@ -58,7 +68,6 @@ public class OpcUtl {
|
|||||||
System.out.println("下发信号失败:"+message.toString());
|
System.out.println("下发信号失败:"+message.toString());
|
||||||
log.info("下发信号失败:"+message.toString());
|
log.info("下发信号失败:"+message.toString());
|
||||||
throw new WDKException(message.toString());
|
throw new WDKException(message.toString());
|
||||||
// group.write(requests);
|
|
||||||
}
|
}
|
||||||
} catch (JIException arg7) {
|
} catch (JIException arg7) {
|
||||||
log.info("下发信号失败:"+arg7.getMessage());
|
log.info("下发信号失败:"+arg7.getMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user