Re: [dbcp] How to create replication aware connection pool ?
On 06/08/2014 01:34, Parth Patil wrote: Hi Friends, I am using DBCP2 in my project and I am pleased with the performance of the library. Though I am only able to provide a single mysql host in the connection string. What do I need to do inorder to make the DBCP connection pool replication aware ? Write some code :). DBCP 2 is not replication aware. There was an enhancement request for this [1] but I resolved it as WONTFIX on the bases that: quote ...generally, failover requires some form of database replication and databases that provide that tend to provide JDBC drivers that support failover as well. /quote I am going to use 1 master and 2 slaves in my setup. Am I correct in assuming that its possible to create connection pool over several mysql hosts ? No, you are not correct. I tried to use the replication aware mysql jdbc driver (com.mysql.jdbc.ReplicationDriver) That is the correct way to do this. but that doesn't seem to work and I am getting an exception. Following is my test code snip/ Following is the exception that I am getting : [error] (run-main-0) java.lang.AbstractMethodError: com.mysql.jdbc.ReplicationConnection.isValid(I)Z snip/ DBCP2 uses JDBC4 (Java 1.6) and that is a new method introduced in that release. You can avoid the call to that method by setting a validation query for your connection pool. For MySQL the following should work: /* ping */ SELECT 1 Mark [1] https://issues.apache.org/jira/browse/DBCP-393 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[math] FiniteDifferencesDifferentiator is not convenient for simple differentiation task
A DerivativeStructure and UnivariateDifferentiableFunction are great tools if one needs to investigate the whole function but are not convenient if one just needs derivative in a given point. In order to calculate a derivative of function in a given point one needs something like that: public static double calculateDerivative(UnivariateFunction function, double point, double step) { FiniteDifferencesDifferentiator diff = new FiniteDifferencesDifferentiator(numPoints, step); UnivariateDifferentiableFunction derivative = diff.differentiate(function); DerivativeStructure x = new DerivativeStructure(1, 1, 0, point); DerivativeStructure y = derivative.value(x); return y.getPartialDerivative(1); } which is not very convenient. Perhaps you could add some helper methods to FiniteDifferencesDifferentiator or to utility class like FunctionUtils. Also it would be good to have helper methods to get the derivatives of UnivariateDifferentiableFunction or MultivariateDifferentiableFunction as simple Univariate or Multivariate functions (or vector-functions). In java 8 it could be simply done by adding some default methods to corresponding interfaces. But since commons-math does not support java 8 (as far as I can understand), it should be some utility class. With best regards, Alexander Nozik. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [math] FiniteDifferencesDifferentiator is not convenient for simple differentiation task
Hi Alexander Le 06/08/2014 15:53, Alexander Nozik a écrit : A DerivativeStructure and UnivariateDifferentiableFunction are great tools if one needs to investigate the whole function but are not convenient if one just needs derivative in a given point. In order to calculate a derivative of function in a given point one needs something like that: public static double calculateDerivative(UnivariateFunction function, double point, double step) { FiniteDifferencesDifferentiator diff = new FiniteDifferencesDifferentiator(numPoints, step); UnivariateDifferentiableFunction derivative = diff.differentiate(function); DerivativeStructure x = new DerivativeStructure(1, 1, 0, point); DerivativeStructure y = derivative.value(x); return y.getPartialDerivative(1); } which is not very convenient. Perhaps you could add some helper methods to FiniteDifferencesDifferentiator or to utility class like FunctionUtils. Also it would be good to have helper methods to get the derivatives of UnivariateDifferentiableFunction or MultivariateDifferentiableFunction as simple Univariate or Multivariate functions (or vector-functions). In java 8 it could be simply done by adding some default methods to corresponding interfaces. But since commons-math does not support java 8 (as far as I can understand), it should be some utility class. You are right, helper methods would be good. Could you open a Jira issue with this idea so we don't forget it? best regards, Luc With best regards, Alexander Nozik. - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [dbcp] How to create replication aware connection pool ?
On 8/6/14 1:15 AM, Mark Thomas wrote: On 06/08/2014 01:34, Parth Patil wrote: Hi Friends, I am using DBCP2 in my project and I am pleased with the performance of the library. Though I am only able to provide a single mysql host in the connection string. What do I need to do inorder to make the DBCP connection pool replication aware ? Write some code :). DBCP 2 is not replication aware. There was an enhancement request for this [1] but I resolved it as WONTFIX on the bases that: quote ...generally, failover requires some form of database replication and databases that provide that tend to provide JDBC drivers that support failover as well. /quote I am going to use 1 master and 2 slaves in my setup. Am I correct in assuming that its possible to create connection pool over several mysql hosts ? No, you are not correct. I tried to use the replication aware mysql jdbc driver (com.mysql.jdbc.ReplicationDriver) That is the correct way to do this. but that doesn't seem to work and I am getting an exception. Following is my test code snip/ Following is the exception that I am getting : [error] (run-main-0) java.lang.AbstractMethodError: com.mysql.jdbc.ReplicationConnection.isValid(I)Z snip/ DBCP2 uses JDBC4 (Java 1.6) and that is a new method introduced in that release. I think you mean JDBC 4.1, Java 1.7 for DBCP2. Phil You can avoid the call to that method by setting a validation query for your connection pool. For MySQL the following should work: /* ping */ SELECT 1 Mark [1] https://issues.apache.org/jira/browse/DBCP-393 - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: Rule profiles for community projects on nemo
Hello, I actually prefer that style its my company default. :) But that rule was only one of the things which might be customizeable for different OSS projects (on nemo). Gruss Bernd Am Wed, 6 Aug 2014 16:08:21 -0400 schrieb Gary Gregory garydgreg...@gmail.com: I've wanted to fix the silly old { } style in VFS for a long time. I think I even queried the community about it a long time ago and got no objections. Feel free to have your IDE reformat it all ;-) Gary On Wed, Aug 6, 2014 at 3:54 PM, Bernd Eckenfels e...@zusammenkunft.net wrote: On nemo.sonarqube.org are a number of usefull open source projects are measured. I wonder if it is possible to influence the rules used for a specific project? Apche VFS has braces-on-new-line coding style and this results in 4098 major(!) issues. (besides I wonder if this is really a major event?) http://nemo.sonarqube.org/dashboard/index/org.apache.commons:commons-vfs2-project Gruss Bernd - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org