@Override public QueryResult process(String query) throws ServerException { QueryResult result; Session dbSession = session.getDbSession(); Command command = null; try { synchronized (dbSession) { command = dbSession.prepareLocal(query); if (command.isQuery()) { ResultInterface resultSet = command.executeQuery(0, false); result = new QueryResult(resultSet); } else { int updateCount = command.executeUpdate(); result = new QueryResult(updateCount); } return result; } } catch (Throwable e) { throw ServerException.convert(e); } finally { if (command != null) { command.close(); } } }