You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/08/10 16:11:44 UTC
activemq-artemis git commit: Make OpenFile Thread Safe
Repository: activemq-artemis
Updated Branches:
refs/heads/2.6.x 01c9479e8 -> c74658e8b
Make OpenFile Thread Safe
(cherry picked from commit af90bc5f435c8e8acaa524602067dbbc5606a662)
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c74658e8
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c74658e8
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c74658e8
Branch: refs/heads/2.6.x
Commit: c74658e8bca879ba9f682a50f6639d42efda584a
Parents: 01c9479
Author: Martyn Taylor <mt...@redhat.com>
Authored: Wed Aug 1 17:54:35 2018 +0100
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Aug 10 12:11:38 2018 -0400
----------------------------------------------------------------------
.../store/file/JDBCSequentialFileFactoryDriver.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c74658e8/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java
----------------------------------------------------------------------
diff --git a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java
index 14ad25e..e736dca 100644
--- a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java
+++ b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java
@@ -108,12 +108,14 @@ public class JDBCSequentialFileFactoryDriver extends AbstractJDBCDriver {
* @throws SQLException
*/
public void openFile(JDBCSequentialFile file) throws SQLException {
- final long fileId = fileExists(file);
- if (fileId < 0) {
- createFile(file);
- } else {
- file.setId(fileId);
- loadFile(file);
+ synchronized (connection) {
+ final long fileId = fileExists(file);
+ if (fileId < 0) {
+ createFile(file);
+ } else {
+ file.setId(fileId);
+ loadFile(file);
+ }
}
}