Re: Totally weird behaviour in org.postgresql.Driver

Поиск
Список
Период
Сортировка
От Peter
Тема Re: Totally weird behaviour in org.postgresql.Driver
Дата
Msg-id 49ba2711$0$1341$834e42db@reader.greatnowhere.com
обсуждение исходный текст
Ответ на Totally weird behaviour in org.postgresql.Driver  ("Peter" <peter@greatnowhere.com>)
Список pgsql-jdbc
> Couple things.... do you really need to synchronize twice in every method
> ???
> Have you looked at dbcp or c3po instead of re-inventing the wheel ?
>
> Can you supply us with a test case which does exhibit the bug ?

I'm fairly sure this is JVM/Tomcat bug I'm dealing with here. The test case
below was configured to run on every request received by servlet, but only
started exhibiting the weird behaviour after few hours of heavy load:


import java.sql.*;
import java.util.logging.Logger;

import org.postgresql.ds.PGSimpleDataSource;

public class PGTester {

 public static void main() {

  org.postgresql.ds.PGSimpleDataSource _ds=new
org.postgresql.ds.PGSimpleDataSource();
  _ds.setDatabaseName("mydb");
  _ds.setServerName("myhost");
  _ds.setPortNumber(5432);

  for (int i=0; i<20; i++) {
   Connector con = new Connector(i+1,_ds);
   new Thread(con, "Conn" ).start();
  }
 }

 private static class Connector implements Runnable {
  @SuppressWarnings("unused")
  private int _num;
  private PGSimpleDataSource _ds;

  Connector(int n, PGSimpleDataSource ds) {
   _num = n;
   _ds = ds;
  }

  public void run() {
   for (int i=0; i<100; i++) {
    try {
     Connection conn = _ds.getConnection("user","pass");
     // System.out.println("Connector " + _num + " made connection #" +
(i+1));
     conn.close();
    } catch (Exception e) {
     Logger.getLogger(this.getClass().getName()).severe(e.getMessage());
    }
   }
  }
 }

}






В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef
Следующее
От: Roland Roberts
Дата:
Сообщение: ResultSet.getTimestamp(Calendar) off by one-hour