karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1538238 - /karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java
Date Sat, 02 Nov 2013 17:34:11 GMT
Author: jbonofre
Date: Sat Nov  2 17:34:11 2013
New Revision: 1538238

URL: http://svn.apache.org/r1538238
Log:
[KARAF-2523] Add SQLServer JDBC lock support

Added:
    karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java

Added: karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java?rev=1538238&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java
(added)
+++ karaf/branches/karaf-2.3.x/main/src/main/java/org/apache/karaf/main/SQLServerJDBCLock.java
Sat Nov  2 17:34:11 2013
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.karaf.main;
+
+import java.util.Properties;
+
+/**
+ * Represents an exclusive lock on a database,
+ * used to avoid multiple Karaf instances attempting
+ * to become master.
+ */
+public class SQLServerJDBCLock extends DefaultJDBCLock {
+
+    public SQLServerJDBCLock(Properties properties) {
+        super(properties);
+    }
+
+    @Override
+    Statements createStatements() {
+        Statements statements = new MsSQLServerStatements();
+        return statements;
+    }
+
+    private class MsSQLServerStatements extends Statements {
+
+        @Override
+        public String getLockCreateStatement() {
+            return "SELECT * FROM " + getFullLockTableName();
+        }
+
+    }
+
+}



Mime
View raw message