Split HikariCP into two modules: core and agent.

pull/6/head
Brett Wooldridge 11 years ago
parent b5101d5e18
commit add7af4915

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- For release: mvn release:perform -Darguments=-Dgpg.passphrase=PASSPHRASE -->
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-agent</artifactId>
<version>1.1.7-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>HikariCP-agent</name>
<description>Ultimate JDBC Connection Pool</description>
<url>https://github.com/brettwooldridge/HikariCP</url>
<organization>
<name>Zaxxer.com</name>
<url>https://github.com/brettwooldridge</url>
</organization>
<scm>
<connection>scm:git:git@github.com:brettwooldridge/HikariCP.git</connection>
<developerConnection>scm:git:git@github.com:brettwooldridge/HikariCP.git</developerConnection>
<url>git@github.com:brettwooldridge/HikariCP.git</url>
</scm>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Brett Wooldridge</name>
<email>brett.wooldridge@gmail.com</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<type>maven-plugin</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>HikariCP-agent</Bundle-Name>
<Export-Package>com.zaxxer.hikari.javassist</Export-Package>
<Import-Package>com.sun.tools.attach,javassist.*,javax.management,javax.sql,javax.sql.rowset,,javax.sql.rowset.serial,,javax.sql.rowset.spi,org.slf4j</Import-Package>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Agent-Class>com.zaxxer.hikari.javassist.HikariInstrumentationAgent</Agent-Class>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<!-- outputDirectory>/absolute/path/to/the/output/directory</outputDirectory>
<finalName>filename-of-generated-jar-file</finalName -->
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<show>public</show>
<attach>true</attach>
<maxmemory>1024m</maxmemory>
</configuration>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

@ -21,6 +21,7 @@ import java.lang.instrument.Instrumentation;
import java.util.Properties;
/**
* This class provides the "agentmain" method of the instrumentation agent.
*
* @author Brett Wooldridge
*/
@ -31,7 +32,7 @@ public class HikariInstrumentationAgent
* class transformer.
*
* @param agentArgs arguments to pass to the agent
* @param inst the virtual machine Instrumentation instance used to register our transformer
* @param instrumentation the virtual machine Instrumentation instance used to register our transformer
*/
public static void agentmain(String agentArgs, Instrumentation instrumentation)
{
@ -41,23 +42,4 @@ public class HikariInstrumentationAgent
ClassFileTransformer transformer = (ClassFileTransformer) systemProperties.get("com.zaxxer.hikari.transformer");
instrumentation.addTransformer(transformer, false);
}
static boolean unregisterInstrumenation()
{
boolean unregistered = false;
Properties systemProperties = System.getProperties();
Instrumentation instrumentation = (Instrumentation) systemProperties.get("com.zaxxer.hikari.instrumentation");
if (instrumentation != null)
{
ClassFileTransformer transformer = (ClassFileTransformer) systemProperties.get("com.zaxxer.hikari.transformer");
instrumentation.removeTransformer(transformer);
unregistered = true;
}
systemProperties.remove("com.zaxxer.hikari.instrumentation");
systemProperties.remove("com.zaxxer.hikari.transformer");
return unregistered;
}
}

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- For release: mvn release:perform -Darguments=-Dgpg.passphrase=PASSPHRASE -->
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>1.1.7-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>HikariCP-core</name>
<description>Ultimate JDBC Connection Pool</description>
<url>https://github.com/brettwooldridge/HikariCP</url>
<organization>
<name>Zaxxer.com</name>
<url>https://github.com/brettwooldridge</url>
</organization>
<scm>
<connection>scm:git:git@github.com:brettwooldridge/HikariCP.git</connection>
<developerConnection>scm:git:git@github.com:brettwooldridge/HikariCP.git</developerConnection>
<url>git@github.com:brettwooldridge/HikariCP.git</url>
</scm>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Brett Wooldridge</name>
<email>brett.wooldridge@gmail.com</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jolbox</groupId>
<artifactId>bonecp</artifactId>
<version>0.8.0-rc3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode</groupId>
<artifactId>reflectasm</artifactId>
<version>1.01</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<type>maven-plugin</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
<dependency>
<groupId>net.snaq</groupId>
<artifactId>dbpool</artifactId>
<version>5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>HikariCP</Bundle-Name>
<Export-Package>com.zaxxer.hikari</Export-Package>
<Import-Package>com.sun.tools.attach,javassist.*,javax.management,javax.sql,javax.sql.rowset,,javax.sql.rowset.serial,,javax.sql.rowset.spi,org.slf4j</Import-Package>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<!-- outputDirectory>/absolute/path/to/the/output/directory</outputDirectory>
<finalName>filename-of-generated-jar-file</finalName -->
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<show>public</show>
<excludePackageNames>com.zaxxer.hikari.*</excludePackageNames>
<attach>true</attach>
<maxmemory>1024m</maxmemory>
</configuration>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
import com.zaxxer.hikari.javassist.AgentRegistrationElf;
import com.zaxxer.hikari.proxy.IHikariConnectionProxy;
import com.zaxxer.hikari.proxy.JavassistProxyFactoryFactory;
import com.zaxxer.hikari.util.ClassLoaderUtils;
import com.zaxxer.hikari.util.PropertyBeanSetter;
/**
@ -78,6 +77,8 @@ public final class HikariPool implements HikariPoolMBean
this.jdbc4ConnectionTest = configuration.isJdbc4ConnectionTest();
this.leakDetectionThreshold = configuration.getLeakDetectionThreshold();
// Class<?> pbs = PropertyBeanSetter.class;
String dsClassName = configuration.getDataSourceClassName();
try
{
@ -88,7 +89,7 @@ public final class HikariPool implements HikariPoolMBean
LOGGER.info("Using Javassist delegate-based proxies.");
}
Class<?> clazz = ClassLoaderUtils.loadClass(dsClassName);
Class<?> clazz = this.getClass().getClassLoader().loadClass(dsClassName);
this.dataSource = (DataSource) clazz.newInstance();
PropertyBeanSetter.setTargetFromProperties(dataSource, configuration.getDataSourceProperties());
}

@ -17,6 +17,8 @@
package com.zaxxer.hikari.javassist;
import java.io.IOException;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
import java.lang.management.ManagementFactory;
import java.net.URL;
import java.util.Properties;
@ -39,7 +41,7 @@ public class AgentRegistrationElf
public static boolean loadTransformerAgent(String dsClassName, String shadedCodexMapping)
{
String agentJarPath = getSelfJarPath();
String agentJarPath = getAgentJarPath();
if (agentJarPath == null)
{
LOGGER.warn("Cannot find the HikariCP jar file through introspection.");
@ -66,7 +68,7 @@ public class AgentRegistrationElf
}
finally
{
if (HikariInstrumentationAgent.unregisterInstrumenation())
if (unregisterInstrumenation())
{
LOGGER.info("Unloaded instrumentation agent.");
}
@ -78,7 +80,7 @@ public class AgentRegistrationElf
*
* @return the path to the jar file that contains this class
*/
private static String getSelfJarPath()
private static String getAgentJarPath()
{
URL resource = AgentRegistrationElf.class.getResource("/com/zaxxer/hikari/javassist/HikariInstrumentationAgent.class");
if (resource == null)
@ -95,7 +97,7 @@ public class AgentRegistrationElf
}
else
{
return System.getProperty("com.zaxxer.hikari.selfJar");
return System.getProperty("com.zaxxer.hikari.agentJar");
}
return jarPath;
@ -120,6 +122,25 @@ public class AgentRegistrationElf
vm.detach();
}
private static boolean unregisterInstrumenation()
{
boolean unregistered = false;
Properties systemProperties = System.getProperties();
Instrumentation instrumentation = (Instrumentation) systemProperties.get("com.zaxxer.hikari.instrumentation");
if (instrumentation != null)
{
ClassFileTransformer transformer = (ClassFileTransformer) systemProperties.get("com.zaxxer.hikari.transformer");
instrumentation.removeTransformer(transformer);
unregistered = true;
}
systemProperties.remove("com.zaxxer.hikari.instrumentation");
systemProperties.remove("com.zaxxer.hikari.transformer");
return unregistered;
}
/**
* Get the PID of the running JVM.
*

@ -28,8 +28,6 @@ import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.zaxxer.hikari.util.ClassLoaderUtils;
/**
*
* @author Brett Wooldridge
@ -107,6 +105,7 @@ public class HikariClassScanner
}
catch (Exception e)
{
LOGGER.warn("Unable to instrument classes", e);
return false;
}
}
@ -211,7 +210,7 @@ public class HikariClassScanner
transformer.setScanClass(classes, classType);
for (String clazz : classes)
{
ClassLoaderUtils.loadClass(clazz);
this.getClass().getClassLoader().loadClass(clazz);
}
}
}

@ -42,6 +42,15 @@ import javassist.bytecode.annotation.Annotation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.zaxxer.hikari.proxy.CallableStatementProxy;
import com.zaxxer.hikari.proxy.ConnectionProxy;
import com.zaxxer.hikari.proxy.IHikariConnectionProxy;
import com.zaxxer.hikari.proxy.IHikariResultSetProxy;
import com.zaxxer.hikari.proxy.IHikariStatementProxy;
import com.zaxxer.hikari.proxy.PreparedStatementProxy;
import com.zaxxer.hikari.proxy.ResultSetProxy;
import com.zaxxer.hikari.proxy.StatementProxy;
/**
*
* @author Brett Wooldridge
@ -104,12 +113,13 @@ public class HikariClassTransformer implements ClassFileTransformer
{
classPool = new ClassPool();
classPool.appendClassPath(new LoaderClassPath(loader));
classPool.appendClassPath(new LoaderClassPath(this.getClass().getClassLoader()));
}
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(loader);
Thread.currentThread().setContextClassLoader(classPool.getClassLoader());
ClassFile classFile = new ClassFile(new DataInputStream(new ByteArrayInputStream(classfileBuffer)));
@ -122,21 +132,21 @@ public class HikariClassTransformer implements ClassFileTransformer
case CONNECTION_SUBCLASS:
return transformConnectionSubclass(classFile);
case STATEMENT:
return transformBaseClass(classFile, "com.zaxxer.hikari.proxy.StatementProxy", "com.zaxxer.hikari.proxy.IHikariStatementProxy");
return transformBaseClass(classFile, StatementProxy.class, IHikariStatementProxy.class);
case STATEMENT_SUBCLASS:
return transformClass(classFile, "com.zaxxer.hikari.proxy.StatementProxy");
return transformClass(classFile, StatementProxy.class);
case PREPARED_STATEMENT:
return transformBaseClass(classFile, "com.zaxxer.hikari.proxy.PreparedStatementProxy", "com.zaxxer.hikari.proxy.IHikariStatementProxy");
return transformBaseClass(classFile, PreparedStatementProxy.class, IHikariStatementProxy.class);
case PREPARED_STATEMENT_SUBCLASS:
return transformClass(classFile, "com.zaxxer.hikari.proxy.PreparedStatementProxy");
return transformClass(classFile, PreparedStatementProxy.class);
case CALLABLE_STATEMENT:
return transformBaseClass(classFile, "com.zaxxer.hikari.proxy.CallableStatementProxy", "com.zaxxer.hikari.proxy.IHikariStatementProxy");
return transformBaseClass(classFile, CallableStatementProxy.class, IHikariStatementProxy.class);
case CALLABLE_STATEMENT_SUBCLASS:
return transformClass(classFile, "com.zaxxer.hikari.proxy.CallableStatementProxy");
return transformClass(classFile, CallableStatementProxy.class);
case RESULTSET:
return transformBaseClass(classFile, "com.zaxxer.hikari.proxy.ResultSetProxy", "com.zaxxer.hikari.proxy.IHikariResultSetProxy");
return transformBaseClass(classFile, ResultSetProxy.class, IHikariResultSetProxy.class);
case RESULTSET_SUBCLASS:
return transformClass(classFile, "com.zaxxer.hikari.proxy.ResultSetProxy");
return transformClass(classFile, ResultSetProxy.class);
default:
// None of the interfaces we care about were found, so just return the class file buffer
return classfileBuffer;
@ -168,11 +178,11 @@ public class HikariClassTransformer implements ClassFileTransformer
String className = classFile.getName();
CtClass target = classPool.getCtClass(className);
CtClass intf = classPool.get("com.zaxxer.hikari.proxy.IHikariConnectionProxy");
CtClass intf = classPool.get(IHikariConnectionProxy.class.getName());
target.addInterface(intf);
LOGGER.debug("Added interface {} to {}", intf.getName(), className);
CtClass proxy = classPool.get("com.zaxxer.hikari.proxy.ConnectionProxy");
CtClass proxy = classPool.get(ConnectionProxy.class.getName());
copyFields(proxy, target);
copyMethods(proxy, target, classFile);
@ -194,7 +204,7 @@ public class HikariClassTransformer implements ClassFileTransformer
{
String className = classFile.getName();
CtClass target = classPool.getCtClass(className);
CtClass proxy = classPool.get("com.zaxxer.hikari.proxy.ConnectionProxy");
CtClass proxy = classPool.get(ConnectionProxy.class.getName());
overrideMethods(proxy, target, classFile);
injectTryCatch(target);
@ -211,33 +221,33 @@ public class HikariClassTransformer implements ClassFileTransformer
/**
* @param classFile
*/
private byte[] transformBaseClass(ClassFile classFile, String proxyClassName, String intfName) throws Exception
private byte[] transformBaseClass(ClassFile classFile, Class<?> proxyClass, Class<?> interfase) throws Exception
{
String className = classFile.getName();
CtClass target = classPool.getCtClass(className);
CtClass intf = classPool.get(intfName);
CtClass intf = classPool.get(interfase.getName());
target.addInterface(intf);
LOGGER.debug("Added interface {} to {}", intf.getName(), className);
CtClass proxy = classPool.get(proxyClassName);
CtClass proxy = classPool.get(proxyClass.getName());
copyFields(proxy, target);
copyMethods(proxy, target, classFile);
mergeClassInitializers(proxy, target, classFile);
return transformClass(classFile, proxyClassName);
return transformClass(classFile, proxyClass);
}
/**
* @param classFile
*/
private byte[] transformClass(ClassFile classFile, String proxyClassName) throws Exception
private byte[] transformClass(ClassFile classFile, Class<?> proxyClass) throws Exception
{
String className = classFile.getName();
CtClass target = classPool.getCtClass(className);
CtClass proxy = classPool.get(proxyClassName);
CtClass proxy = classPool.get(proxyClass.getName());
overrideMethods(proxy, target, classFile);
injectTryCatch(target);
@ -277,7 +287,7 @@ public class HikariClassTransformer implements ClassFileTransformer
CtMethod copy = CtNewMethod.copy(method, targetClass, null);
AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
Annotation annotation = new Annotation("com.zaxxer.hikari.javassist.HikariInject", constPool);
Annotation annotation = new Annotation(HikariInject.class.getName(), constPool);
attr.setAnnotation(annotation);
copy.getMethodInfo().addAttribute(attr);
targetClass.addMethod(copy);
@ -289,7 +299,7 @@ public class HikariClassTransformer implements ClassFileTransformer
{
ConstPool constPool = targetClassFile.getConstPool();
AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
Annotation annotation = new Annotation("com.zaxxer.hikari.javassist.HikariOverride", constPool);
Annotation annotation = new Annotation(HikariOverride.class.getName(), constPool);
attr.setAnnotation(annotation);
for (CtMethod method : srcClass.getMethods())
@ -299,13 +309,18 @@ public class HikariClassTransformer implements ClassFileTransformer
continue;
}
if ((targetClass.getModifiers() & Modifier.ABSTRACT) == Modifier.ABSTRACT)
{
continue;
}
try
{
CtMethod destMethod = targetClass.getDeclaredMethod(method.getName(), method.getParameterTypes());
LOGGER.debug("Rename method {}{} to __{}", destMethod.getName(), destMethod.getSignature(), destMethod.getName());
destMethod.setName("__" + destMethod.getName());
destMethod.getMethodInfo().addAttribute(attr);
CtMethod copy = CtNewMethod.copy(method, targetClass, null);
copy.getMethodInfo().addAttribute(attr);
targetClass.addMethod(copy);
@ -313,7 +328,7 @@ public class HikariClassTransformer implements ClassFileTransformer
}
catch (NotFoundException nfe)
{
continue;
// fall thru
}
}
}

@ -0,0 +1,210 @@
# This is a manually maintained codex of JDBC drivers and the
# classes within that need to be instrumented.
#
# ------ HSQLDB v2.3.1 ----------------------------------------------------------
#
org.hsqldb.jdbc.JDBCDataSource=hsqldb
hsqldb.baseConnection=org.hsqldb.jdbc.JDBCConnection
hsqldb.baseStatement=org.hsqldb.jdbc.JDBCStatement
hsqldb.basePreparedStatement=org.hsqldb.jdbc.JDBCPreparedStatement
hsqldb.subCallableStatement=org.hsqldb.jdbc.JDBCCallableStatement
hsqldb.baseResultSet=org.hsqldb.jdbc.JDBCResultSet
hsqldb.subResultSet=org.hsqldb.jdbc.JDBCResultSet$JDBCResultSetBasic
# ------ Derby v10.10.1.1 -------------------------------------------------------
#
org.apache.derby.jdbc.ClientDataSource40=derby
derby.baseConnection=org.apache.derby.client.am.Connection
derby.subConnection=org.apache.derby.client.net.NetConnection40
derby.baseStatement=org.apache.derby.client.am.Statement
derby.subPreparedStatement=org.apache.derby.client.am.PreparedStatement
derby.subPreparedStatement=org.apache.derby.client.am.PreparedStatement40
#derby.subPreparedStatement=org.apache.derby.client.am.PreparedStatement42
derby.subCallableStatement=org.apache.derby.client.am.CallableStatement
derby.subCallableStatement=org.apache.derby.client.am.CallableStatement40
#derby.subCallableStatement=org.apache.derby.client.am.CallableStatement42
derby.baseResultSet=org.apache.derby.client.am.ResultSet
derby.subResultSet=org.apache.derby.client.net.NetResultSet40
#derby.subResultSet=org.apache.derby.client.net.NetResultSet42
# ------ Derby Embedded v10.10.1.1 ----------------------------------------------
#
derby-em.baseConnection=org.apache.derby.impl.jdbc.EmbedConnection
derby-em.baseConnection=org.apache.derby.iapi.jdbc.BrokeredConnection
derby-em.subConnection=org.apache.derby.impl.jdbc.EmbedConnection40
derby-em.subConnection=org.apache.derby.iapi.jdbc.BrokeredConnection40
#derby-em.subConnection=org.apache.derby.iapi.jdbc.BrokeredConnection42
derby-em.baseStatement=org.apache.derby.impl.jdbc.EmbedStatement
derby-em.baseStatement=org.apache.derby.iapi.jdbc.BrokeredStatement
derby-em.baseStatement=org.apache.derby.client.am.Statement
derby-em.subStatement=org.apache.derby.impl.jdbc.EmbedStatement40
derby-em.subStatement=org.apache.derby.iapi.jdbc.BrokeredStatement40
derby-em.subPreparedStatement=org.apache.derby.impl.jdbc.EmbedPreparedStatement
derby-em.subPreparedStatement=org.apache.derby.impl.jdbc.EmbedPreparedStatement20
derby-em.subPreparedStatement=org.apache.derby.impl.jdbc.EmbedPreparedStatement30
derby-em.subPreparedStatement=org.apache.derby.impl.jdbc.EmbedPreparedStatement40
#derby-em.subPreparedStatement=org.apache.derby.impl.jdbc.EmbedPreparedStatement42
derby-em.subPreparedStatement=org.apache.derby.iapi.jdbc.BrokeredPreparedStatement
derby-em.subPreparedStatement=org.apache.derby.iapi.jdbc.BrokeredPreparedStatement40
#derby-em.subPreparedStatement=org.apache.derby.iapi.jdbc.BrokeredPreparedStatement42
derby-em.subPreparedStatement=org.apache.derby.client.am.PreparedStatement
derby-em.subPreparedStatement=org.apache.derby.client.am.PreparedStatement40
#derby-em.subPreparedStatement=org.apache.derby.client.am.PreparedStatement42
derby-em.subCallableStatement=org.apache.derby.impl.jdbc.EmbedCallableStatement
derby-em.subCallableStatement=org.apache.derby.impl.jdbc.EmbedCallableStatement20
derby-em.subCallableStatement=org.apache.derby.impl.jdbc.EmbedCallableStatement30
derby-em.subCallableStatement=org.apache.derby.impl.jdbc.EmbedCallableStatement40
#derby-em.subCallableStatement=org.apache.derby.impl.jdbc.EmbedCallableStatement42
derby-em.subCallableStatement=org.apache.derby.iapi.jdbc.BrokeredCallableStatement
derby-em.subCallableStatement=org.apache.derby.iapi.jdbc.BrokeredCallableStatement40
#derby-em.subCallableStatement=org.apache.derby.iapi.jdbc.BrokeredCallableStatement42
derby-em.subCallableStatement=org.apache.derby.client.am.CallableStatement
derby-em.subCallableStatement=org.apache.derby.client.am.CallableStatement40
#derby-em.subCallableStatement=org.apache.derby.client.am.CallableStatement42
# ------ PostgreSQL v9.2-1003.jdbc4 ----------------------------------------------
#
org.postgresql.ds.PGSimpleDataSource=pgsql
pgsql.baseConnection=org.postgresql.jdbc2.AbstractJdbc2Connection
pgsql.subConnection=org.postgresql.jdbc3.AbstractJdbc3Connection
pgsql.subConnection=org.postgresql.jdbc3g.AbstractJdbc3gConnection
pgsql.subConnection=org.postgresql.jdbc4.AbstractJdbc4Connection
pgsql.subConnection=org.postgresql.jdbc4.Jdbc4Connection
pgsql.basePreparedStatement=org.postgresql.jdbc2.AbstractJdbc2Statement
pgsql.subPreparedStatement=org.postgresql.jdbc3.AbstractJdbc3Statement
pgsql.subPreparedStatement=org.postgresql.jdbc3g.AbstractJdbc3gStatement
pgsql.subPreparedStatement=org.postgresql.jdbc4.AbstractJdbc4Statement
pgsql.subPreparedStatement=org.postgresql.jdbc4.Jdbc4Statement
pgsql.subPreparedStatement=org.postgresql.jdbc4.Jdbc4PreparedStatement
pgsql.subCallableStatement=org.postgresql.jdbc4.Jdbc4CallableStatement
pgsql.baseResultSet=org.postgresql.jdbc2.AbstractJdbc2ResultSet
pgsql.subResultSet=org.postgresql.jdbc3.AbstractJdbc3ResultSet
pgsql.subResultSet=org.postgresql.jdbc3g.AbstractJdbc3gResultSet
pgsql.subResultSet=org.postgresql.jdbc4.AbstractJdbc4ResultSet
pgsql.subResultSet=org.postgresql.jdbc4.Jdbc4ResultSet
# ------ MySQL Connector/J v5.1.26 ----------------------------------------------
#
com.mysql.jdbc.jdbc2.optional.MysqlDataSource=mysql
mysql.baseConnection=com.mysql.jdbc.ConnectionImpl
mysql.baseConnection=com.mysql.jdbc.ReplicationConnection
mysql.baseConnection=com.mysql.jdbc.LoadBalancedMySQLConnection
mysql.subConnection=com.mysql.jdbc.JDBC4Connection
mysql.subConnection=com.mysql.jdbc.JDBC4LoadBalancedMySQLConnection
mysql.baseStatement=com.mysql.jdbc.StatementImpl
mysql.subPreparedStatement=com.mysql.jdbc.PreparedStatement
mysql.subPreparedStatement=com.mysql.jdbc.ServerPreparedStatement
mysql.subPreparedStatement=com.mysql.jdbc.JDBC4ServerPreparedStatement
mysql.subCallableStatement=com.mysql.jdbc.CallableStatement
mysql.subCallableStatement=com.mysql.jdbc.JDBC4CallableStatement
mysql.baseResultSet=com.mysql.jdbc.ResultSetImpl
mysql.subResultSet=com.mysql.jdbc.JDBC4ResultSet
mysql.subResultSet=com.mysql.jdbc.UpdatableResultSet
mysql.subResultSet=com.mysql.jdbc.JDBC4UpdatableResultSet
# ------ MariaDB JDBC v1.1.5 --------------------------------------------------
#
org.mariadb.jdbc.MySQLDataSource=maria
maria.baseConnection=org.mariadb.jdbc.MySQLConnection
maria.baseStatement=org.mariadb.jdbc.MySQLStatement
maria.subPreparedStatement=org.mariadb.jdbc.MySQLPreparedStatement
maria.baseCallableStatement=org.mariadb.jdbc.MySQLCallableStatement
maria.baseResultSet=org.mariadb.jdbc.MySQLResultSet
# ------ JTDS v1.3.1 ----------------------------------------------------------
#
net.sourceforge.jtds.jdbcx.JtdsDataSource=jtds
jtds.baseConnection=net.sourceforge.jtds.jdbc.JtdsConnection
jtds.baseConnection=net.sourceforge.jtds.jdbcx.proxy.ConnectionProxy
jtds.baseStatement=net.sourceforge.jtds.jdbc.JtdsStatement
jtds.baseStatement=net.sourceforge.jtds.jdbcx.proxy.StatementProxy
jtds.subPreparedStatement=net.sourceforge.jtds.jdbc.JtdsPreparedStatement
jtds.subPreparedStatement=net.sourceforge.jtds.jdbcx.proxy.PreparedStatementProxy
jtds.subCallableStatement=net.sourceforge.jtds.jdbc.JtdsCallableStatement
jtds.subCallableStatement=net.sourceforge.jtds.jdbcx.proxy.CallableStatementProxy
jtds.baseResultSet=net.sourceforge.jtds.jdbc.JtdsResultSet
jtds.subResultSet=net.sourceforge.jtds.jdbc.CachedResultSet
jtds.subResultSet=net.sourceforge.jtds.jdbc.MSCursorResultSet
# ------ Oracle v12.1.0.1 -----------------------------------------------------
#
oracle.jdbc.pool.OracleDataSource=oracle
oracle.baseConnection=oracle.jdbc.driver.OracleConnection
oracle.subConnection=oracle.jdbc.driver.PhysicalConnection
oracle.subConnection=oracle.jdbc.driver.T4CConnection
oracle.baseStatement=oracle.jdbc.driver.OracleStatement
oracle.subPreparedStatement=oracle.jdbc.driver.OraclePreparedStatement
oracle.subCallableStatement=oracle.jdbc.driver.OracleCallableStatement
oracle.baseResultSet=oracle.jdbc.driver.OracleResultSet
oracle.subResultSet=oracle.jdbc.driver.ArrayDataResultSet
oracle.subResultSet=oracle.jdbc.driver.GeneratedScrollableResultSet
oracle.subResultSet=oracle.jdbc.driver.InsensitiveScrollableResultSet
oracle.subResultSet=oracle.jdbc.driver.ForwardOnlyResultSet
oracle.subResultSet=oracle.jdbc.driver.ArrayLocatorResultSet
oracle.subResultSet=oracle.jdbc.driver.SensitiveScrollableResultSet
oracle.subResultSet=oracle.jdbc.driver.OracleReturnResultSet
oracle.subResultSet=oracle.jdbc.driver.GeneratedUpdatableResultSet
oracle.subResultSet=oracle.jdbc.driver.UpdatableResultSet
# ------ HikariCP Testing v0.0.0 ----------------------------------------------
#
com.zaxxer.hikari.mocks.StubDataSource=hikari
hikari.baseConnection=com.zaxxer.hikari.mocks.StubBaseConnection
hikari.subConnection=com.zaxxer.hikari.mocks.StubConnection
hikari.baseStatement=com.zaxxer.hikari.mocks.StubStatement
hikari.subPreparedStatement=com.zaxxer.hikari.mocks.StubPreparedStatement
hikari.baseResultSet=com.zaxxer.hikari.mocks.StubResultSet
com.zaxxer.hikari.performance.StubDataSource=hikari-perf
hikari-perf.baseConnection=com.zaxxer.hikari.performance.StubConnection
hikari-perf.baseStatement=com.zaxxer.hikari.performance.StubStatement
hikari-perf.subPreparedStatement=com.zaxxer.hikari.performance.StubPreparedStatement
hikari-perf.baseResultSet=com.zaxxer.hikari.performance.StubResultSet

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- For release: mvn release:perform -Darguments=-Dgpg.passphrase=PASSPHRASE -->
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<artifactId>HikariCP-parent</artifactId>
<version>1.1.7-SNAPSHOT</version>
<packaging>bundle</packaging>
<packaging>pom</packaging>
<name>HikariCP</name>
<name>HikariCP-parent</name>
<description>Ultimate JDBC Connection Pool</description>
<url>https://github.com/brettwooldridge/HikariCP</url>
@ -49,176 +48,58 @@
<version>7</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jolbox</groupId>
<artifactId>bonecp</artifactId>
<version>0.8.0-rc3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode</groupId>
<artifactId>reflectasm</artifactId>
<version>1.01</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<type>maven-plugin</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
<dependency>
<groupId>net.snaq</groupId>
<artifactId>dbpool</artifactId>
<version>5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>core</module>
<module>agent</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${project.version}</version>
<classifier>test-sources</classifier>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${project.version}</version>
<classifier>javadoc</classifier>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<type>test-jar</type>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>HikariCP</Bundle-Name>
<Export-Package>com.zaxxer.hikari</Export-Package>
<Import-Package>com.sun.tools.attach,javassist.*,javax.management,javax.sql,javax.sql.rowset,,javax.sql.rowset.serial,,javax.sql.rowset.spi,org.slf4j</Import-Package>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Agent-Class>com.zaxxer.hikari.javassist.HikariInstrumentationAgent</Agent-Class>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<!-- outputDirectory>/absolute/path/to/the/output/directory</outputDirectory>
<finalName>filename-of-generated-jar-file</finalName -->
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<show>public</show>
<excludePackageNames>com.zaxxer.hikari.*</excludePackageNames>
<attach>true</attach>
<maxmemory>1024m</maxmemory>
</configuration>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>com.zaxxer.hikari-@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Loading…
Cancel
Save