Skip to content

Commit 5edd5fd

Browse files
committed
cleaning
1 parent d78b11d commit 5edd5fd

File tree

1 file changed

+7
-22
lines changed
  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/client

1 file changed

+7
-22
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/client/ClientRunner.java

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
package org.apache.iotdb.db.pipe.sink.protocol.opcua.client;
2121

22+
import org.apache.iotdb.commons.pipe.config.PipeConfig;
23+
import org.apache.iotdb.pipe.api.exception.PipeException;
24+
2225
import org.bouncycastle.jce.provider.BouncyCastleProvider;
2326
import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
2427
import org.eclipse.milo.opcua.stack.client.security.DefaultClientCertificateValidator;
@@ -115,35 +118,17 @@ public void run() {
115118
Thread.currentThread().interrupt();
116119
logger.warn("Error disconnecting: ", e);
117120
}
118-
119-
try {
120-
Thread.sleep(1000);
121-
System.exit(0);
122-
} catch (final InterruptedException e) {
123-
Thread.currentThread().interrupt();
124-
e.printStackTrace();
125-
}
126121
});
127122

128123
try {
129124
configurableUaClient.run(client);
130-
future.get(100000, TimeUnit.SECONDS);
125+
future.get(
126+
PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs(), TimeUnit.MICROSECONDS);
131127
} catch (final Exception e) {
132-
logger.warn("Error running client example: ", e);
133-
future.completeExceptionally(e);
128+
throw new PipeException("Error running client example.", e);
134129
}
135130
} catch (final Exception e) {
136-
logger.warn("Error getting client: ", e);
137-
138-
future.completeExceptionally(e);
139-
140-
try {
141-
Thread.sleep(1000);
142-
System.exit(0);
143-
} catch (InterruptedException interruptedException) {
144-
Thread.currentThread().interrupt();
145-
logger.warn("Interrupted when running client: ", e);
146-
}
131+
throw new PipeException("Error getting client.", e);
147132
}
148133
}
149134
}

0 commit comments

Comments
 (0)