Hi,
I am using some user defined functions like this:
public static boolean isPrime(int value) {
return BigInteger.valueOf(value).isProbablePrime(100);
}
public static ResultSet query(Connection conn, String sql) throws SQLException {
return conn.createStatement().executeQuery(sql);
}
As for as I know it is better to avoid public static functions in a multi threaded application and it is betterto maken that methods synchronized like this:
public
synchronized
static boolean isPrime(int value) {
return BigInteger.valueOf(value).isProbablePrime(100);
}
public
synchronized
static ResultSet query(Connection conn, String sql) throws SQLException {
return conn.createStatement().executeQuery(sql);
}
Sometimes our server has a deadlock on some user defined functions. I think it is because I made them
synchronized.
What do you think?
Hope somebody give some advice about this. Thanks