Merge pull request #453 from vincentbernat/feature/parallel-dbi
authorPierre-Yves Ritschard <pyr@spootnik.org>
Tue, 15 Oct 2013 13:49:22 +0000 (06:49 -0700)
committerPierre-Yves Ritschard <pyr@spootnik.org>
Tue, 15 Oct 2013 13:49:22 +0000 (06:49 -0700)
Handle several databases in parallel with dbi plugin

bindings/java/org/collectd/java/GenericJMXConfConnection.java
src/mysql.c
src/postgresql.c

index 7fad08f..99b140a 100644 (file)
@@ -118,6 +118,7 @@ private void connect () /* {{{ */
 
     environment = new HashMap ();
     environment.put (JMXConnector.CREDENTIALS, credentials);
+    environment.put(JMXConnectorFactory.PROTOCOL_PROVIDER_CLASS_LOADER, this.getClass().getClassLoader());
   }
 
   try
index d15a055..6337ab4 100644 (file)
@@ -287,6 +287,7 @@ static void set_host (mysql_database_t *db, char *buf, size_t buflen)
 {
        if ((db->host == NULL)
                        || (strcmp ("", db->host) == 0)
+                       || (strcmp ("127.0.0.1", db->host) == 0)
                        || (strcmp ("localhost", db->host) == 0))
                sstrncpy (buf, hostname_g, buflen);
        else
index 1eaf6bd..16e539a 100644 (file)
@@ -571,6 +571,7 @@ static int c_psql_exec_query (c_psql_database_t *db, udb_query_t *q,
        }
 
        if (C_PSQL_IS_UNIX_DOMAIN_SOCKET (db->host)
+                       || (0 == strcmp (db->host, "127.0.0.1"))
                        || (0 == strcmp (db->host, "localhost")))
                host = hostname_g;
        else