From 83c70b97673c109c82479380c6d7270bc3b0b26a Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Thu, 20 Apr 2017 22:03:07 +0800 Subject: [PATCH] --- src/org/redkale/source/CacheMemorySource.java | 140 +++- src/org/redkale/source/DataJdbcSource.java | 660 ++++++++++++++---- 2 files changed, 637 insertions(+), 163 deletions(-) diff --git a/src/org/redkale/source/CacheMemorySource.java b/src/org/redkale/source/CacheMemorySource.java index 33e7da7ff..c7ab30e07 100644 --- a/src/org/redkale/source/CacheMemorySource.java +++ b/src/org/redkale/source/CacheMemorySource.java @@ -202,8 +202,14 @@ public class CacheMemorySource extends @Override public void existsAsync(final AsyncHandler handler, @RpcAttachment final K key) { - boolean rs = exists(key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + boolean rs = exists(key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -223,8 +229,14 @@ public class CacheMemorySource extends @Override public void getAsync(final AsyncHandler handler, @RpcAttachment final K key) { - V rs = get(key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + V rs = get(key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -247,8 +259,14 @@ public class CacheMemorySource extends @Override public void getAndRefreshAsync(final AsyncHandler handler, @RpcAttachment final K key, final int expireSeconds) { - V rs = getAndRefresh(key, expireSeconds); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + V rs = getAndRefresh(key, expireSeconds); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -268,8 +286,14 @@ public class CacheMemorySource extends @Override public void refreshAsync(final AsyncHandler handler, @RpcAttachment final K key, final int expireSeconds) { - refresh(key, expireSeconds); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + refresh(key, expireSeconds); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -294,8 +318,14 @@ public class CacheMemorySource extends @Override public void setAsync(final AsyncHandler handler, @RpcAttachment final K key, final V value) { - set(key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + set(key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -320,8 +350,14 @@ public class CacheMemorySource extends @Override public void setAsync(final AsyncHandler handler, final int expireSeconds, @RpcAttachment final K key, final V value) { - set(expireSeconds, key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + set(expireSeconds, key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -340,8 +376,14 @@ public class CacheMemorySource extends @Override public void setExpireSecondsAsync(final AsyncHandler handler, @RpcAttachment final K key, final int expireSeconds) { - setExpireSeconds(key, expireSeconds); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + setExpireSeconds(key, expireSeconds); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -358,8 +400,14 @@ public class CacheMemorySource extends @Override public void removeAsync(final AsyncHandler handler, @RpcAttachment final K key) { - remove(key); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + remove(key); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -374,8 +422,14 @@ public class CacheMemorySource extends @Override public void getCollectionAsync(final AsyncHandler, K> handler, @RpcAttachment final K key) { - Collection rs = getCollection(key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + Collection rs = getCollection(key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -390,8 +444,14 @@ public class CacheMemorySource extends @Override public void getCollectionAndRefreshAsync(final AsyncHandler, K> handler, @RpcAttachment final K key, final int expireSeconds) { - Collection rs = getCollectionAndRefresh(key, expireSeconds); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + Collection rs = getCollectionAndRefresh(key, expireSeconds); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -417,8 +477,14 @@ public class CacheMemorySource extends @Override public void appendListItemAsync(final AsyncHandler handler, @RpcAttachment final K key, final V value) { - appendListItem(key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + appendListItem(key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -437,8 +503,14 @@ public class CacheMemorySource extends @Override public void removeListItemAsync(final AsyncHandler handler, @RpcAttachment final K key, final V value) { - removeListItem(key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + removeListItem(key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -464,8 +536,14 @@ public class CacheMemorySource extends @Override public void appendSetItemAsync(final AsyncHandler handler, @RpcAttachment final K key, final V value) { - appendSetItem(key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + appendSetItem(key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -484,8 +562,14 @@ public class CacheMemorySource extends @Override public void removeSetItemAsync(final AsyncHandler handler, @RpcAttachment final K key, final V value) { - removeSetItem(key, value); - if (handler != null) handler.completed(null, key); + super.runAsync(() -> { + try { + removeSetItem(key, value); + if (handler != null) handler.completed(null, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } public static enum CacheEntryType { diff --git a/src/org/redkale/source/DataJdbcSource.java b/src/org/redkale/source/DataJdbcSource.java index 7fe9913e2..0a3d3bab7 100644 --- a/src/org/redkale/source/DataJdbcSource.java +++ b/src/org/redkale/source/DataJdbcSource.java @@ -152,8 +152,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void insertAsync(final AsyncHandler handler, @RpcAttachment @RpcCall(DataCallArrayAttribute.class) final T... values) { - insert(values); - if (handler != null) handler.completed(null, values); + super.runAsync(() -> { + try { + insert(values); + if (handler != null) handler.completed(null, values); + } catch (Throwable t) { + if (handler != null) handler.failed(t, values); + } + }); } private void insert(final Connection conn, final EntityInfo info, T... values) { @@ -336,8 +342,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void deleteAsync(final AsyncHandler handler, @RpcAttachment final T... values) { - int rs = delete(values); - if (handler != null) handler.completed(rs, values); + super.runAsync(() -> { + try { + int rs = delete(values); + if (handler != null) handler.completed(rs, values); + } catch (Throwable t) { + if (handler != null) handler.failed(t, values); + } + }); } private int delete(final Connection conn, final EntityInfo info, T... values) { @@ -372,8 +384,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void deleteAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final Serializable... ids) { - int rs = delete(clazz, ids); - if (handler != null) handler.completed(rs, ids); + super.runAsync(() -> { + try { + int rs = delete(clazz, ids); + if (handler != null) handler.completed(rs, ids); + } catch (Throwable t) { + if (handler != null) handler.failed(t, ids); + } + }); } private int delete(final Connection conn, final EntityInfo info, Serializable... keys) { @@ -431,8 +449,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void deleteAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final FilterNode node) { - int rs = delete(clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = delete(clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -456,8 +480,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void deleteAsync(final AsyncHandler handler, final Class clazz, final Flipper flipper, @RpcAttachment FilterNode node) { - int rs = delete(clazz, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = delete(clazz, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private int delete(final Connection conn, final EntityInfo info, final Flipper flipper, final FilterNode node) { @@ -477,7 +507,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi } String sql = "DELETE " + (this.readPool.isMysql() ? "a" : "") + " FROM " + info.getTable(node) + " a" + (join1 == null ? "" : (", " + join1)) + ((where == null || where.length() == 0) ? (join2 == null ? "" : (" WHERE " + join2)) - : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))) + info.createSQLOrderby(flipper) + : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))) + info.createSQLOrderby(flipper) + ((flipper == null || flipper.getLimit() < 1) ? "" : (" LIMIT " + flipper.getLimit())); if (debug.get() && info.isLoggable(Level.FINEST)) logger.finest(info.getType().getSimpleName() + " delete sql=" + sql); conn.setReadOnly(false); @@ -553,8 +583,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateAsync(final AsyncHandler handler, @RpcAttachment final T... values) { - int rs = update(values); - if (handler != null) handler.completed(rs, values); + super.runAsync(() -> { + try { + int rs = update(values); + if (handler != null) handler.completed(rs, values); + } catch (Throwable t) { + if (handler != null) handler.failed(t, values); + } + }); } private int update(final Connection conn, final EntityInfo info, T... values) { @@ -655,8 +691,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final Class clazz, final Serializable id, final String column, final Serializable value) { - int rs = updateColumn(clazz, id, column, value); - if (handler != null) handler.completed(rs, id); + super.runAsync(() -> { + try { + int rs = updateColumn(clazz, id, column, value); + if (handler != null) handler.completed(rs, id); + } catch (Throwable t) { + if (handler != null) handler.failed(t, id); + } + }); } private int updateColumn(Connection conn, final EntityInfo info, Serializable id, String column, final Serializable value) { @@ -728,8 +770,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final Class clazz, final String column, final Serializable value, @RpcAttachment final FilterNode node) { - int rs = updateColumn(clazz, column, value, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = updateColumn(clazz, column, value, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private int updateColumn(Connection conn, final EntityInfo info, String column, final Serializable value, FilterNode node) { @@ -751,7 +799,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi String sql = "UPDATE " + info.getTable(node) + " a " + (join1 == null ? "" : (", " + join1)) + " SET " + info.getSQLColumn("a", column) + " = ?" + ((where == null || where.length() == 0) ? (join2 == null ? "" : (" WHERE " + join2)) - : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); + : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); if (debug.get() && info.isLoggable(Level.FINEST)) logger.finest(info.getType().getSimpleName() + " update sql=" + sql); conn.setReadOnly(false); Blob blob = conn.createBlob(); @@ -764,7 +812,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi String sql = "UPDATE " + info.getTable(node) + " a " + (join1 == null ? "" : (", " + join1)) + " SET " + info.getSQLColumn("a", column) + " = " + info.formatToString(value) + ((where == null || where.length() == 0) ? (join2 == null ? "" : (" WHERE " + join2)) - : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); + : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); if (debug.get() && info.isLoggable(Level.FINEST)) logger.finest(info.getType().getSimpleName() + " update sql=" + sql); conn.setReadOnly(false); final Statement stmt = conn.createStatement(); @@ -816,8 +864,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final Serializable id, final ColumnValue... values) { - int rs = updateColumn(clazz, id, values); - if (handler != null) handler.completed(rs, id); + super.runAsync(() -> { + try { + int rs = updateColumn(clazz, id, values); + if (handler != null) handler.completed(rs, id); + } catch (Throwable t) { + if (handler != null) handler.failed(t, id); + } + }); } private int updateColumn(final Connection conn, final EntityInfo info, final Serializable id, final ColumnValue... values) { @@ -908,8 +962,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final FilterNode node, final ColumnValue... values) { - int rs = updateColumn(clazz, node, values); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = updateColumn(clazz, node, values); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } /** @@ -944,8 +1004,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final FilterNode node, final Flipper flipper, final ColumnValue... values) { - int rs = updateColumn(clazz, node, flipper, values); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = updateColumn(clazz, node, flipper, values); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private int updateColumn(final Connection conn, final EntityInfo info, final FilterNode node, final Flipper flipper, final ColumnValue... values) { @@ -987,7 +1053,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi } String sql = "UPDATE " + info.getTable(node) + " a " + (join1 == null ? "" : (", " + join1)) + " SET " + setsql + ((where == null || where.length() == 0) ? (join2 == null ? "" : (" WHERE " + join2)) - : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); + : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); //注:LIMIT 仅支持MySQL 且在多表关联式会异常, 该BUG尚未解决 sql += info.createSQLOrderby(flipper) + ((flipper == null || flipper.getLimit() < 1) ? "" : (" LIMIT " + flipper.getLimit())); if (debug.get() && info.isLoggable(Level.FINEST)) logger.finest(info.getType().getSimpleName() + " update sql=" + sql); @@ -1031,8 +1097,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, @RpcAttachment final T bean, final String... columns) { - int rs = updateColumn(bean, columns); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + int rs = updateColumn(bean, columns); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1047,8 +1119,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final T bean, @RpcAttachment final FilterNode node, final String... columns) { - int rs = updateColumn(bean, node, columns); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = updateColumn(bean, node, columns); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1072,8 +1150,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, @RpcAttachment final T bean, final SelectColumn selects) { - int rs = updateColumn(bean, selects); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + int rs = updateColumn(bean, selects); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } private int updateColumns(final Connection conn, final EntityInfo info, final T bean, final SelectColumn selects) { @@ -1154,8 +1238,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void updateColumnAsync(final AsyncHandler handler, final T bean, @RpcAttachment final FilterNode node, final SelectColumn selects) { - int rs = updateColumn(bean, node, selects); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + int rs = updateColumn(bean, node, selects); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private int updateColumns(final Connection conn, final EntityInfo info, final T bean, final FilterNode node, final SelectColumn selects) { @@ -1197,7 +1287,7 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi } String sql = "UPDATE " + info.getTable(node) + " a " + (join1 == null ? "" : (", " + join1)) + " SET " + setsql + ((where == null || where.length() == 0) ? (join2 == null ? "" : (" WHERE " + join2)) - : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); + : (" WHERE " + where + (join2 == null ? "" : (" AND " + join2)))); if (debug.get() && info.isLoggable(Level.FINEST)) logger.finest(info.getType().getSimpleName() + " update sql=" + sql); conn.setReadOnly(false); if (blobs != null) { @@ -1267,8 +1357,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberResultAsync(final AsyncHandler handler, final Class entityClass, final FilterFunc func, @RpcAttachment final String column) { - Number rs = getNumberResult(entityClass, func, column); - if (handler != null) handler.completed(rs, column); + super.runAsync(() -> { + try { + Number rs = getNumberResult(entityClass, func, column); + if (handler != null) handler.completed(rs, column); + } catch (Throwable t) { + if (handler != null) handler.failed(t, column); + } + }); } @Override @@ -1283,8 +1379,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberResultAsync(final AsyncHandler handler, final Class entityClass, final FilterFunc func, final String column, @RpcAttachment final B bean) { - Number rs = getNumberResult(entityClass, func, column, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Number rs = getNumberResult(entityClass, func, column, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1299,8 +1401,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberResultAsync(final AsyncHandler handler, final Class entityClass, final FilterFunc func, final String column, @RpcAttachment final FilterNode node) { - Number rs = getNumberResult(entityClass, func, column, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Number rs = getNumberResult(entityClass, func, column, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1315,8 +1423,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberResultAsync(final AsyncHandler handler, final Class entityClass, final FilterFunc func, final Number defVal, @RpcAttachment final String column) { - Number rs = getNumberResult(entityClass, func, defVal, column); - if (handler != null) handler.completed(rs, column); + super.runAsync(() -> { + try { + Number rs = getNumberResult(entityClass, func, defVal, column); + if (handler != null) handler.completed(rs, column); + } catch (Throwable t) { + if (handler != null) handler.failed(t, column); + } + }); } @Override @@ -1341,8 +1455,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberResultAsync(final AsyncHandler handler, final Class entityClass, final FilterFunc func, final Number defVal, @RpcAttachment final String column, final FilterNode node) { - Number rs = getNumberResult(entityClass, func, defVal, column, node); - if (handler != null) handler.completed(rs, column); + super.runAsync(() -> { + try { + Number rs = getNumberResult(entityClass, func, defVal, column, node); + if (handler != null) handler.completed(rs, column); + } catch (Throwable t) { + if (handler != null) handler.failed(t, column); + } + }); } @Override @@ -1357,8 +1477,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberMapAsync(final AsyncHandler, FilterFuncColumn[]> handler, final Class entityClass, @RpcAttachment final FilterFuncColumn... columns) { - Map rs = getNumberMap(entityClass, columns); - if (handler != null) handler.completed(rs, columns); + super.runAsync(() -> { + try { + Map rs = getNumberMap(entityClass, columns); + if (handler != null) handler.completed(rs, columns); + } catch (Throwable t) { + if (handler != null) handler.failed(t, columns); + } + }); } @Override @@ -1373,8 +1499,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberMapAsync(final AsyncHandler, B> handler, final Class entityClass, @RpcAttachment final B bean, final FilterFuncColumn... columns) { - Map rs = getNumberMap(entityClass, bean, columns); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Map rs = getNumberMap(entityClass, bean, columns); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1449,8 +1581,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void getNumberMapAsync(final AsyncHandler, FilterNode> handler, final Class entityClass, @RpcAttachment final FilterNode node, final FilterFuncColumn... columns) { - Map rs = getNumberMap(entityClass, node, columns); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Map rs = getNumberMap(entityClass, node, columns); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1503,8 +1641,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnMapAsync(final AsyncHandler, String> handler, final Class entityClass, @RpcAttachment final String keyColumn, final FilterFunc func, final String funcColumn) { - Map rs = queryColumnMap(entityClass, keyColumn, func, funcColumn); - if (handler != null) handler.completed(rs, keyColumn); + super.runAsync(() -> { + try { + Map rs = queryColumnMap(entityClass, keyColumn, func, funcColumn); + if (handler != null) handler.completed(rs, keyColumn); + } catch (Throwable t) { + if (handler != null) handler.failed(t, keyColumn); + } + }); } @Override @@ -1568,8 +1712,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnMapAsync(final AsyncHandler, String> handler, final Class entityClass, @RpcAttachment final String keyColumn, final FilterFunc func, final String funcColumn, final FilterNode node) { - Map rs = queryColumnMap(entityClass, keyColumn, func, funcColumn, node); - if (handler != null) handler.completed(rs, keyColumn); + super.runAsync(() -> { + try { + Map rs = queryColumnMap(entityClass, keyColumn, func, funcColumn, node); + if (handler != null) handler.completed(rs, keyColumn); + } catch (Throwable t) { + if (handler != null) handler.failed(t, keyColumn); + } + }); } //-----------------------findAsync---------------------------- @@ -1594,8 +1744,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final Serializable pk) { - T rs = find(clazz, pk); - if (handler != null) handler.completed(rs, pk); + super.runAsync(() -> { + try { + T rs = find(clazz, pk); + if (handler != null) handler.completed(rs, pk); + } catch (Throwable t) { + if (handler != null) handler.failed(t, pk); + } + }); } @Override @@ -1637,8 +1793,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, SelectColumn selects, @RpcAttachment final Serializable pk) { - T rs = find(clazz, selects, pk); - if (handler != null) handler.completed(rs, pk); + super.runAsync(() -> { + try { + T rs = find(clazz, selects, pk); + if (handler != null) handler.completed(rs, pk); + } catch (Throwable t) { + if (handler != null) handler.failed(t, pk); + } + }); } @Override @@ -1653,8 +1815,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, final String column, @RpcAttachment final Serializable key) { - T rs = find(clazz, column, key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + T rs = find(clazz, column, key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -1669,8 +1837,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final B bean) { - T rs = find(clazz, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + T rs = find(clazz, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1685,8 +1859,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final FilterNode node) { - T rs = find(clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + T rs = find(clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1701,8 +1881,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, final SelectColumn selects, @RpcAttachment final B bean) { - T rs = find(clazz, selects, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + T rs = find(clazz, selects, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1744,8 +1930,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findAsync(final AsyncHandler handler, final Class clazz, final SelectColumn selects, @RpcAttachment final FilterNode node) { - T rs = find(clazz, selects, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + T rs = find(clazz, selects, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1760,8 +1952,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, @RpcAttachment final Serializable pk) { - Serializable rs = findColumn(clazz, column, pk); - if (handler != null) handler.completed(rs, pk); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, pk); + if (handler != null) handler.completed(rs, pk); + } catch (Throwable t) { + if (handler != null) handler.failed(t, pk); + } + }); } @Override @@ -1776,8 +1974,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, @RpcAttachment final B bean) { - Serializable rs = findColumn(clazz, column, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1792,8 +1996,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, @RpcAttachment final FilterNode node) { - Serializable rs = findColumn(clazz, column, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1843,8 +2053,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, final Serializable defValue, @RpcAttachment final Serializable pk) { - Serializable rs = findColumn(clazz, column, defValue, pk); - if (handler != null) handler.completed(rs, pk); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, defValue, pk); + if (handler != null) handler.completed(rs, pk); + } catch (Throwable t) { + if (handler != null) handler.failed(t, pk); + } + }); } @Override @@ -1859,8 +2075,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, final Serializable defValue, @RpcAttachment final B bean) { - Serializable rs = findColumn(clazz, column, defValue, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, defValue, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -1910,8 +2132,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void findColumnAsync(final AsyncHandler handler, final Class clazz, final String column, final Serializable defValue, @RpcAttachment final FilterNode node) { - Serializable rs = findColumn(clazz, column, defValue, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Serializable rs = findColumn(clazz, column, defValue, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -1955,8 +2183,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void existsAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final Serializable pk) { - boolean rs = exists(clazz, pk); - if (handler != null) handler.completed(rs, pk); + super.runAsync(() -> { + try { + boolean rs = exists(clazz, pk); + if (handler != null) handler.completed(rs, pk); + } catch (Throwable t) { + if (handler != null) handler.failed(t, pk); + } + }); } @Override @@ -1971,8 +2205,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void existsAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final B bean) { - boolean rs = exists(clazz, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + boolean rs = exists(clazz, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2016,8 +2256,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void existsAsync(final AsyncHandler handler, final Class clazz, @RpcAttachment final FilterNode node) { - boolean rs = exists(clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + boolean rs = exists(clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } //-----------------------list set---------------------------- @@ -2033,8 +2279,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnSetAsync(final AsyncHandler, String> handler, final String selectedColumn, final Class clazz, @RpcAttachment final String column, final Serializable key) { - HashSet rs = queryColumnSet(selectedColumn, clazz, column, key); - if (handler != null) handler.completed(rs, column); + super.runAsync(() -> { + try { + HashSet rs = queryColumnSet(selectedColumn, clazz, column, key); + if (handler != null) handler.completed(rs, column); + } catch (Throwable t) { + if (handler != null) handler.failed(t, column); + } + }); } @Override @@ -2049,8 +2301,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnSetAsync(final AsyncHandler, B> handler, final String selectedColumn, final Class clazz, @RpcAttachment final B bean) { - HashSet rs = queryColumnSet(selectedColumn, clazz, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + HashSet rs = queryColumnSet(selectedColumn, clazz, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2065,8 +2323,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnSetAsync(final AsyncHandler, FilterNode> handler, final String selectedColumn, final Class clazz, @RpcAttachment final FilterNode node) { - HashSet rs = queryColumnSet(selectedColumn, clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + HashSet rs = queryColumnSet(selectedColumn, clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -2081,8 +2345,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnListAsync(final AsyncHandler, Serializable> handler, final String selectedColumn, final Class clazz, final String column, @RpcAttachment final Serializable key) { - List rs = queryColumnList(selectedColumn, clazz, column, key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + List rs = queryColumnList(selectedColumn, clazz, column, key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -2097,8 +2367,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnListAsync(final AsyncHandler, B> handler, String selectedColumn, Class clazz, @RpcAttachment B bean) { - List rs = queryColumnList(selectedColumn, clazz, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryColumnList(selectedColumn, clazz, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2113,8 +2389,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnListAsync(final AsyncHandler, FilterNode> handler, final String selectedColumn, final Class clazz, @RpcAttachment final FilterNode node) { - List rs = queryColumnList(selectedColumn, clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryColumnList(selectedColumn, clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -2129,8 +2411,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnListAsync(final AsyncHandler, B> handler, String selectedColumn, Class clazz, Flipper flipper, @RpcAttachment B bean) { - List rs = queryColumnList(selectedColumn, clazz, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryColumnList(selectedColumn, clazz, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2145,8 +2433,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnListAsync(final AsyncHandler, FilterNode> handler, final String selectedColumn, final Class clazz, Flipper flipper, @RpcAttachment final FilterNode node) { - List rs = queryColumnList(selectedColumn, clazz, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryColumnList(selectedColumn, clazz, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } /** @@ -2173,8 +2467,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnSheetAsync(final AsyncHandler, B> handler, String selectedColumn, Class clazz, Flipper flipper, @RpcAttachment B bean) { - Sheet rs = queryColumnSheet(selectedColumn, clazz, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Sheet rs = queryColumnSheet(selectedColumn, clazz, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2189,8 +2489,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryColumnSheetAsync(final AsyncHandler, FilterNode> handler, final String selectedColumn, final Class clazz, final Flipper flipper, @RpcAttachment final FilterNode node) { - Sheet rs = queryColumnSheet(selectedColumn, clazz, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Sheet rs = queryColumnSheet(selectedColumn, clazz, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private Sheet queryColumnSheet(final boolean needtotal, final String selectedColumn, final Class clazz, final Flipper flipper, final FilterNode node) { @@ -2230,8 +2536,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, Serializable> handler, final Class clazz, final String column, @RpcAttachment final Serializable key) { - List rs = queryList(clazz, column, key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + List rs = queryList(clazz, column, key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } /** @@ -2255,8 +2567,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, B> handler, final Class clazz, @RpcAttachment final B bean) { - List rs = queryList(clazz, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryList(clazz, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2271,8 +2589,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, FilterNode> handler, final Class clazz, @RpcAttachment final FilterNode node) { - List rs = queryList(clazz, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryList(clazz, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } /** @@ -2297,8 +2621,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, B> handler, final Class clazz, final SelectColumn selects, @RpcAttachment final B bean) { - List rs = queryList(clazz, selects, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryList(clazz, selects, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2313,8 +2643,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, FilterNode> handler, final Class clazz, final SelectColumn selects, @RpcAttachment final FilterNode node) { - List rs = queryList(clazz, selects, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryList(clazz, selects, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -2329,8 +2665,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, Serializable> handler, final Class clazz, final Flipper flipper, final String column, @RpcAttachment final Serializable key) { - List rs = queryList(clazz, flipper, column, key); - if (handler != null) handler.completed(rs, key); + super.runAsync(() -> { + try { + List rs = queryList(clazz, flipper, column, key); + if (handler != null) handler.completed(rs, key); + } catch (Throwable t) { + if (handler != null) handler.failed(t, key); + } + }); } @Override @@ -2345,8 +2687,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, B> handler, final Class clazz, final Flipper flipper, @RpcAttachment final B bean) { - List rs = queryList(clazz, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryList(clazz, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2361,8 +2709,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, FilterNode> handler, final Class clazz, final Flipper flipper, @RpcAttachment final FilterNode node) { - List rs = queryList(clazz, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryList(clazz, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } @Override @@ -2377,8 +2731,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, B> handler, final Class clazz, final SelectColumn selects, final Flipper flipper, @RpcAttachment final B bean) { - List rs = queryList(clazz, selects, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + List rs = queryList(clazz, selects, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2393,8 +2753,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void queryListAsync(final AsyncHandler, FilterNode> handler, final Class clazz, final SelectColumn selects, final Flipper flipper, @RpcAttachment final FilterNode node) { - List rs = queryList(clazz, selects, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + List rs = queryList(clazz, selects, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } //-----------------------sheet---------------------------- @@ -2420,8 +2786,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void querySheetAsync(final AsyncHandler, B> handler, final Class clazz, final Flipper flipper, @RpcAttachment final B bean) { - Sheet rs = querySheet(clazz, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Sheet rs = querySheet(clazz, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2436,8 +2808,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void querySheetAsync(final AsyncHandler, FilterNode> handler, final Class clazz, final Flipper flipper, @RpcAttachment final FilterNode node) { - Sheet rs = querySheet(clazz, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Sheet rs = querySheet(clazz, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } /** @@ -2463,8 +2841,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void querySheetAsync(final AsyncHandler, B> handler, final Class clazz, final SelectColumn selects, final Flipper flipper, @RpcAttachment final B bean) { - Sheet rs = querySheet(clazz, selects, flipper, bean); - if (handler != null) handler.completed(rs, bean); + super.runAsync(() -> { + try { + Sheet rs = querySheet(clazz, selects, flipper, bean); + if (handler != null) handler.completed(rs, bean); + } catch (Throwable t) { + if (handler != null) handler.failed(t, bean); + } + }); } @Override @@ -2479,8 +2863,14 @@ public class DataJdbcSource extends AbstractService implements DataSource, Servi @Override public void querySheetAsync(final AsyncHandler, FilterNode> handler, final Class clazz, final SelectColumn selects, final Flipper flipper, @RpcAttachment final FilterNode node) { - Sheet rs = querySheet(clazz, selects, flipper, node); - if (handler != null) handler.completed(rs, node); + super.runAsync(() -> { + try { + Sheet rs = querySheet(clazz, selects, flipper, node); + if (handler != null) handler.completed(rs, node); + } catch (Throwable t) { + if (handler != null) handler.failed(t, node); + } + }); } private Sheet querySheet(final boolean readcache, final boolean needtotal, final Class clazz, final SelectColumn selects, final Flipper flipper, final FilterNode node) {