use of io.mycat.monitor.MycatSQLLogMonitor in project Mycat2 by MyCATApache.
the class HintHandler method getSqlTimeFilter.
private Future<Void> getSqlTimeFilter(Response response, String body, MetadataManager metadataManager) {
ResultSetBuilder resultSetBuilder = ResultSetBuilder.create();
resultSetBuilder.addColumnInfo("value", JDBCType.VARCHAR);
long sqlTimeFilter = -1;
if (MetaClusterCurrent.exist(MycatSQLLogMonitor.class)) {
MycatSQLLogMonitor mycatSQLLogMonitor = MetaClusterCurrent.wrapper(MycatSQLLogMonitor.class);
sqlTimeFilter = mycatSQLLogMonitor.getSqlTimeFilter();
}
resultSetBuilder.addObjectRowPayload(Arrays.asList(sqlTimeFilter));
return response.sendResultSet(resultSetBuilder.build());
}
use of io.mycat.monitor.MycatSQLLogMonitor in project Mycat2 by MyCATApache.
the class HintHandler method setSqlTimeFilter.
private Future<Void> setSqlTimeFilter(Response response, String body, MetadataManager metadataManager) {
Map map = JsonUtil.from(body, Map.class);
Object value = map.get("value");
if (value != null) {
long s = Long.parseLong(value.toString());
if (MetaClusterCurrent.exist(MycatSQLLogMonitor.class)) {
MycatSQLLogMonitor mycatSQLLogMonitor = MetaClusterCurrent.wrapper(MycatSQLLogMonitor.class);
mycatSQLLogMonitor.setSqlTimeFilter(s);
}
}
return response.sendOk();
}
Aggregations