aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-10-19 11:02:02 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-10-19 11:02:02 +0200
commit03fd91021257124849677eb12e6b3330c5755c6d (patch)
treeb8f719e430203ecf48415e17bb559a4cac4408c3 /sonar-plugin-api
parentc0a0e72e7f05afb9a46e9fe3734ae1173009ae88 (diff)
downloadsonarqube-03fd91021257124849677eb12e6b3330c5755c6d.tar.gz
sonarqube-03fd91021257124849677eb12e6b3330c5755c6d.zip
SONAR-3887 add org.sonar.api.utils.DatabaseSemaphore
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/DatabaseSemaphore.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DatabaseSemaphore.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DatabaseSemaphore.java
new file mode 100644
index 00000000000..f01a6e6f25f
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/DatabaseSemaphore.java
@@ -0,0 +1,36 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.api.utils;
+
+import org.sonar.api.BatchComponent;
+import org.sonar.api.ServerComponent;
+
+/**
+ * A semaphore shared among all the processes that can connect to the central database.
+ *
+ * @since 3.4
+ */
+public interface DatabaseSemaphore extends BatchComponent, ServerComponent {
+
+ boolean acquire(String name, int maxDurationInSeconds);
+
+ void release(String name);
+
+}