|
35 | 35 | import io.vertx.ext.sql.SQLClient;
|
36 | 36 | import io.vertx.ext.sql.SQLConnection;
|
37 | 37 | import org.apache.commons.lang3.StringUtils;
|
| 38 | +import org.apache.flink.configuration.Configuration; |
38 | 39 | import org.apache.flink.streaming.api.functions.async.ResultFuture;
|
39 | 40 | import org.apache.flink.table.runtime.types.CRow;
|
40 | 41 | import org.apache.flink.table.typeutils.TimeIndicatorTypeInfo;
|
@@ -86,6 +87,15 @@ public class RdbAsyncReqRow extends BaseAsyncReqRow {
|
86 | 87 |
|
87 | 88 | private transient ThreadPoolExecutor executor;
|
88 | 89 |
|
| 90 | + private final static int MAX_TASK_QUEUE_SIZE = 100000; |
| 91 | + |
| 92 | + @Override |
| 93 | + public void open(Configuration parameters) throws Exception { |
| 94 | + super.open(parameters); |
| 95 | + executor = new ThreadPoolExecutor(MAX_DB_CONN_POOL_SIZE_LIMIT, MAX_DB_CONN_POOL_SIZE_LIMIT, 0, TimeUnit.MILLISECONDS, |
| 96 | + new LinkedBlockingQueue<>(MAX_TASK_QUEUE_SIZE), new DTThreadFactory("rdbAsyncExec"), new ThreadPoolExecutor.CallerRunsPolicy()); |
| 97 | + } |
| 98 | + |
89 | 99 | public RdbAsyncReqRow(BaseSideInfo sideInfo) {
|
90 | 100 | super(sideInfo);
|
91 | 101 | init(sideInfo);
|
@@ -248,10 +258,6 @@ public void setRdbSqlClient(SQLClient rdbSqlClient) {
|
248 | 258 | this.rdbSqlClient = rdbSqlClient;
|
249 | 259 | }
|
250 | 260 |
|
251 |
| - public void setExecutor(ThreadPoolExecutor executor) { |
252 |
| - this.executor = executor; |
253 |
| - } |
254 |
| - |
255 | 261 | private void handleQuery(SQLConnection connection, Map<String, Object> inputParams, CRow input, ResultFuture<CRow> resultFuture){
|
256 | 262 | String key = buildCacheKey(inputParams);
|
257 | 263 | JsonArray params = new JsonArray(Lists.newArrayList(inputParams.values()));
|
|
0 commit comments