@Override public Thread newThread(Runnable r) { return new AgentAwareThread(r, threadTransformHelper); } };
/** * The default constructor which needs one parameter for initialization. * * @param platformManager * The Platform manager. * @param parameter * Additional parameters. */ public ExceptionSensorHook(IPlatformManager platformManager, Map<String, Object> parameter) { this.platformManager = platformManager; this.strConstraint = new StringConstraint(parameter); }
/** * Retrieves the meta information object from the connection. * * @param connectionClass * the connection class. * @param connection * the connection instance. * @return the meta information object from the connection or <code>null</code> in case of * problems. */ private Object getMetaData(Class<?> connectionClass, Object connection) { return cache.invokeMethod(connectionClass, GET_META_DATA, null, connection, null, null, JAVA_SQL_CONNECTION_FQN); }
/** * {@inheritDoc} */ @Override public void firstAfterBody(long methodId, long sensorTypeId, Object object, Object[] parameters, Object result, boolean exception, RegisteredSensorConfig rsc) { timeStack.push(new Double(timer.getCurrentTime())); }
@Test(expectedExceptions = { IllegalArgumentException.class }) public void testNegativeIndex() { CharacterRingBuffer rb = new CharacterRingBuffer("test"); rb.charAt(-1); }
/** * Removes the last added sql from the thread local stack. We don't need the String object here. */ protected void removeSql() { sqlThreadLocalStack.pop(); }
/** * This method adds an SQL String to the current thread local stack. This is needed so that * created prepared statements can be associated to the SQL Strings. * <p> * So if three times the prepared statement method is called with the same string, the stack * contains the string three times. Now the Prepared Statement is created which results in * calling the {@link #addPreparedStatement(Object, String)} method. The last added String is * taken and associated with the object. * * @param sql * The SQL String. */ protected void addSql(String sql) { sqlThreadLocalStack.push(sql); }
/** * {@inheritDoc} */ @Override public String toString() { return getAsString(0, length); }
/** * {@inheritDoc} */ @Override public void firstAfterBody(long methodId, long sensorTypeId, Object object, Object[] parameters, Object result, boolean exception, RegisteredSensorConfig rsc) { timeStack.push(new Double(timer.getCurrentTime())); }
/** * Retrieves the version of the database. * * @param databaseMetaDataClass * the meta information class. * @param databaseMetaData * the meta information instance of the connection. * @return the version of the database. */ private String parseVersion(Class<?> databaseMetaDataClass, Object databaseMetaData) { return (String) cache.invokeMethod(databaseMetaDataClass, GET_DATABASE_PRODUCT_VERSION, null, databaseMetaData, null, null, JAVA_SQL_DATABASE_META_DATA_FQN); }
@Override public Thread newThread(Runnable r) { return new AgentAwareThread(r, threadTransformHelper); } };
/** * {@inheritDoc} */ @Override public void beforeBody(long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { timeStack.push(new Double(timer.getCurrentTime())); threadLast.set(Boolean.TRUE); }
/** * Checks if the connection is closed. * * @param connectionClass * the connection class. * @param connection * the connection instance. * @return the result of calling isClosed on the connection object or <code>true</code> any * exception occurs during method invocation */ private boolean isClosed(Class<?> connectionClass, Object connection) { return (Boolean) cache.invokeMethod(connectionClass, IS_CLOSED, null, connection, null, true, JAVA_SQL_CONNECTION_FQN); }
/** * {@inheritDoc} */ @Override public void beforeBody(long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { timeStack.push(new Double(timer.getCurrentTime())); threadLast.set(Boolean.TRUE); }
/** * Retrieves the product name of the database. * * @param databaseMetaDataClass * the meta information class. * @param databaseMetaData * the meta information instance of the connection. * @return the product name of the database. */ private String parseProduct(Class<?> databaseMetaDataClass, Object databaseMetaData) { return (String) cache.invokeMethod(databaseMetaDataClass, GET_DATABASE_PRODUCT_NAME, null, databaseMetaData, null, null, JAVA_SQL_DATABASE_META_DATA_FQN); } }
/** * {@inheritDoc} */ @Override public void beforeBody(long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { timeStack.push(new Double(timer.getCurrentTime())); if (enabled) { threadCpuTimeStack.push(Long.valueOf(threadMXBean.getCurrentThreadCpuTime())); } }
/** * {@inheritDoc} */ @Override public void setSpanStore(SpanStore spanStore) { cache.invokeMethod(httpContext.getClass(), "setAttribute", new Class<?>[] { String.class, Object.class }, httpContext, new Object[] { SpanStoreAdapter.Constants.ID, spanStore }, null); } }
/** * {@inheritDoc} */ @Override public SpanStore getSpanStore() { Object spanStore = cache.invokeMethod(httpContext.getClass(), "getAttribute", new Class<?>[] { String.class }, httpContext, new Object[] { SpanStoreAdapter.Constants.ID }, null); if (spanStore instanceof SpanStore) { return (SpanStore) spanStore; } return null; }