Revision 37927

View differences:

trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/AutomaticDataSource.java
33 33
    private DataSource ds;
34 34
    private boolean opened = false;
35 35
    private long timeout;
36
    private Timer timer = new Timer();
36
//    private Timer timer = new Timer();
37 37
    private long lastReset = 0;
38 38

  
39 39
    /**
......
78 78
             * the resetTimer is a long time operation. Will
79 79
             * only call it after a while
80 80
             */
81
            if ((System.currentTimeMillis() - lastReset) > (DataSourceFactory.DEFAULT_DELAY / 2)) {
82
                //reset the timer
83
//                logger.info("timer reset");
84
               	timer.resetTimer();
85
                lastReset = System.currentTimeMillis();
86
            }
81
//            if ((System.currentTimeMillis() - lastReset) > (DataSourceFactory.DEFAULT_DELAY / 2)) {
82
//                //reset the timer
83
////                logger.info("timer reset");
84
////               	timer.resetTimer();
85
//                lastReset = System.currentTimeMillis();
86
//            }
87 87
        } else {
88 88
            opened = true;
89 89

  
......
96 96
//            logger.info("timer start");
97 97

  
98 98
            // Se inicia el timer
99
            timer.schedule(new Task() {
100
                    /**
101
                     * @see com.hardcode.gdbms.engine.internalExceptions.Task#execute()
102
                     */
103
                    public void execute() {
104
                        try {
105
                            synchronized (AutomaticDataSource.this) {
106
                                if (opened){
107
                                    close();
108
                                }
109
                            }
110
                        } catch (CloseDriverException e) {
111
                            InternalExceptionCatcher.callExceptionRaised(new InternalExceptionEvent(
112
                                    AutomaticDataSource.this,
113
                                    new InternalException(
114
                                        "Could not automatically close the data source",
115
                                        e)));
116
                        }
117
                    }
118

  
119
                }, timeout);
99
//            timer.schedule(new Task() {
100
//                    /**
101
//                     * @see com.hardcode.gdbms.engine.internalExceptions.Task#execute()
102
//                     */
103
//                    public void execute() {
104
//                        try {
105
//                            synchronized (AutomaticDataSource.this) {
106
//                                if (opened){
107
//                                    close();
108
//                                }
109
//                            }
110
//                        } catch (CloseDriverException e) {
111
//                            InternalExceptionCatcher.callExceptionRaised(new InternalExceptionEvent(
112
//                                    AutomaticDataSource.this,
113
//                                    new InternalException(
114
//                                        "Could not automatically close the data source",
115
//                                        e)));
116
//                        }
117
//                    }
118
//
119
//                }, timeout);
120 120
        }
121 121
    }
122 122

  
......
132 132

  
133 133
//            logger.info("datasource closed");
134 134

  
135
            AutomaticDataSource.this.timer.cancelTimer();
136
            AutomaticDataSource.this.timer = new Timer();
135
//            AutomaticDataSource.this.timer.cancelTimer();
136
//            AutomaticDataSource.this.timer = new Timer();
137 137
        }
138 138
    }
139 139

  
trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/persistence/MementoContentHandler.java
169 169

  
170 170
            }
171 171
            DataSource ds = dsf.executeSQL(olm.getSql(), mode);
172
            dsf.changeDataSourceName(ds.getName(), olm.getName());
172
            // dsf.changeDataSourceName(ds.getName(), olm.getName());
173 173
            return ds;
174 174
        } else if (m instanceof DataSourceLayerMemento) {
175 175
            DataSourceLayerMemento dslm = (DataSourceLayerMemento) m;
trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/db/DBDataSourceAdapter.java
174 174

  
175 175
            if (sem == 0) {
176 176
            	driver.close();
177
            	if (this.con == null) {
177
            	if (this.con != null) {
178 178
	                con.close();
179 179
	                con = null;
180 180
            	}

Also available in: Unified diff