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

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/9ea916f4-623b-4cf9-9f53-6672314a7dbfn%40googlegroups.com.

Reply via email to