summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASING.md46
-rw-r--r--pom.xml82
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransaction.java15
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java30
4 files changed, 158 insertions, 15 deletions
diff --git a/RELEASING.md b/RELEASING.md
new file mode 100644
index 0000000..a7ddd36
--- /dev/null
+++ b/RELEASING.md
@@ -0,0 +1,46 @@
+RELEASING
+=========
+
+This file outlines how to publish a new release to Maven Central.
+
+Prerequisites
+-------------
+
+* You will need the Carbonado GPG key and passphrase to continue. Contact
+ @jesterpm or @pranaydalmia to obtain them.
+
+* You will need an account with Sonatype Nexus. You can create that
+ [here](https://issues.sonatype.org/secure/Signup!default.jspa). Contact
+ @jesterpm or @pranaydalmia for access to the Carbonado repository.
+
+Process
+-------
+
+1. Increment the version number appropriately.
+ Use [Semantic Versioning](http://semver.org/).
+
+ VERSION=1.2.4
+ mvn versions:set -DnewVersion=$VERSION
+
+2. Verify the release and make sure all is well.
+
+ mvn clean verify -P release
+
+3. Commit and tag the latest release.
+
+ git commit -am "Release $VERSION"
+ git tag -a v$VERSION -m "Release $VERSION"
+
+4. Deploy to Sonatype:
+
+ mvn clean deploy -P release
+
+5. Push commit and tag to GitHub
+
+ git push origin master
+ git push origin v$VERSION
+
+6. Create a new Releases on GitHub. Use the tag you just created and optionally
+ include a change log. Attach the compiled, sources, and javadoc jar files,
+ along with the .asc signature files.
+
diff --git a/pom.xml b/pom.xml
index 565f5e9..8c2dca1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<artifactId>carbonado</artifactId>
<packaging>jar</packaging>
<name>Carbonado</name>
- <version>1.3</version>
+ <version>1.3.1</version>
<description>
Extensible, high performance persistence abstraction layer for Java applications with a relational view to the underlying persistence technology.
</description>
@@ -201,6 +201,31 @@
<target>1.7</target>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9.1</version>
+ <configuration>
+ <javadocVersion>1.7</javadocVersion>
+ <detectJavaApiLink>false</detectJavaApiLink>
+ <links>
+ <link>http://docs.oracle.com/javase/7/docs/api</link>
+ </links>
+ <notimestamp>true</notimestamp>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -277,4 +302,59 @@
</plugin>
</plugins>
</reporting>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ <configuration>
+ <keyname>2753E2C6</keyname>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.3</version>
+ <extensions>true</extensions>
+ <configuration>
+ <serverId>ossrh</serverId>
+ <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+ <autoReleaseAfterClose>true</autoReleaseAfterClose>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransaction.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransaction.java
index ffa2e5c..00e6947 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransaction.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransaction.java
@@ -106,10 +106,17 @@ class JDBCTransaction {
}
/**
- * @return connection to close, or null if not ready to because this was a
- * nested transaction
+ * @return true if the connection should be closed after the transaction is aborted.
*/
- Connection abort() throws SQLException {
+ boolean shouldCloseConnection() {
+ return !mIsNested;
+ }
+
+ /**
+ * Note: The caller should close the connection after aborting if
+ * shouldCloseConnection() returns true.
+ */
+ void abort() throws SQLException {
if (mRegisteredLobs != null) {
for (JDBCLob lob : mRegisteredLobs) {
lob.close();
@@ -134,13 +141,11 @@ class JDBCTransaction {
}
}
- return null;
} else {
if (mReady) {
mConnection.rollback();
mReady = false;
}
- return mConnection;
}
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
index c649058..9fe2ff4 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCTransactionManager.java
@@ -97,18 +97,30 @@ class JDBCTransactionManager extends TransactionManager<JDBCTransaction> {
@Override
protected void abortTxn(JDBCTransaction txn) throws PersistException {
+ PersistException ex = null;
+
try {
- Connection con;
- if ((con = txn.abort()) != null) {
- JDBCRepository repo = mRepositoryRef.get();
- if (repo == null) {
- con.close();
- } else {
- repo.closeConnection(con);
+ txn.abort();
+ } catch (Throwable e) {
+ ex = mExTransformer.toPersistException(e);
+ throw ex;
+ } finally {
+ try {
+ if (txn.shouldCloseConnection()) {
+ Connection con = txn.getConnection();
+ JDBCRepository repo = mRepositoryRef.get();
+ if (repo == null) {
+ con.close();
+ } else {
+ repo.closeConnection(con);
+ }
+ }
+ } catch (Throwable e) {
+ // Don't lose the original exception.
+ if (ex == null) {
+ throw mExTransformer.toPersistException(e);
}
}
- } catch (Throwable e) {
- throw mExTransformer.toPersistException(e);
}
}
}