/** * Retrieves the connection. * * @param statementClass * the class of the statement instance. * @param statementInstance * the instance of the statement. * @return the associated connection. */ public Connection getConnection(Class<?> statementClass, Object statementInstance) { return (Connection) invokeMethod(statementClass, GET_CONNECTION_METHOD_NAME, null, statementInstance, null, null, JAVA_SQL_STATEMENT_FQN); } }
/** * {@inheritDoc} */ @Override public void secondAfterBody(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, Object result, boolean exception, RegisteredSensorConfig rsc) { // NOCHK:8-params double endTime = timeStack.pop().doubleValue(); double startTime = timeStack.pop().doubleValue(); if (threadLast.get().booleanValue()) { threadLast.set(Boolean.FALSE); double duration = endTime - startTime; String sql = parameters[0].toString(); Timestamp timestamp = new Timestamp(System.currentTimeMillis() - Math.round(duration)); long platformId = platformManager.getPlatformId(); SqlStatementData sqlData = new SqlStatementData(timestamp, platformId, sensorTypeId, methodId); sqlData.setPreparedStatement(false); sqlData.setSql(strConstraint.crop(sql)); sqlData.setDuration(duration); sqlData.calculateMin(duration); sqlData.calculateMax(duration); sqlData.setCount(1L); // populate the connection meta data. connectionMetaDataStorage.populate(sqlData, statementReflectionCache.getConnection(object.getClass(), object)); coreService.addDefaultData(sqlData); } }
connectionMetaDataStorage.populate(sqlData, statementReflectionCache.getConnection(object.getClass(), object));