Merge branch 'master' of github.com:metamx/druid

This commit is contained in:
Fangjin Yang 2013-03-13 15:45:21 -07:00
commit 60e75d21ce
13 changed files with 19 additions and 16 deletions

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -38,6 +38,7 @@ public class ConfigManager
private final ScheduledExecutorService exec;
private final ConcurrentMap<String, ConfigHolder> watchedConfigs;
private final String selectStatement;
private final String insertStatement;
private volatile ConfigManager.PollingCallable poller;
@ -49,6 +50,10 @@ public class ConfigManager
this.exec = ScheduledExecutors.fixed(1, "config-manager-%s");
this.watchedConfigs = Maps.newConcurrentMap();
this.selectStatement = String.format("SELECT payload FROM %s WHERE name = :name", config.getConfigTable());
insertStatement = String.format(
"INSERT INTO %s (name, payload) VALUES (:name, :payload) ON DUPLICATE KEY UPDATE payload = :payload",
config.getConfigTable()
);
}
@LifecycleStart
@ -192,9 +197,7 @@ public class ConfigManager
@Override
public Void withHandle(Handle handle) throws Exception
{
handle.createStatement(
"INSERT INTO %s (name, payload) VALUES (:name, :payload) ON DUPLICATE KEY UPDATE payload = :payload"
)
handle.createStatement(insertStatement)
.bind("name", key)
.bind("payload", newBytes)
.execute();

View File

@ -24,11 +24,11 @@
<artifactId>druid-services</artifactId>
<name>druid-services</name>
<description>druid-services</description>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<modules>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid-examples</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid-examples</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>

View File

@ -23,7 +23,7 @@
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<packaging>pom</packaging>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
<name>druid</name>
<description>druid</description>
<scm>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<properties>

View File

@ -28,7 +28,7 @@
<parent>
<groupId>com.metamx</groupId>
<artifactId>druid</artifactId>
<version>0.3.20-SNAPSHOT</version>
<version>0.3.21-SNAPSHOT</version>
</parent>
<dependencies>