Revision 1338 trunk/libraries/libGDBMS/src/com/hardcode/gdbms/engine/data/FileDataSourceAdapter.java

View differences:

FileDataSourceAdapter.java
16 16
    private File file;
17 17
    private FileDriver driver;
18 18

  
19
    private int sem = 0;
20
    
19 21
    /**
20 22
     * @see com.hardcode.gdbms.engine.data.DataSource#start()
21 23
     */
22 24
    public void start() throws DriverException {
23 25
        try {
26
        	if (sem == 0)
24 27
            driver.open(file);
28
        	
29
        	sem++;
25 30
        } catch (IOException e) {
26 31
            throw new DriverException(e);
27 32
        }
......
32 37
     */
33 38
    public void stop() throws DriverException {
34 39
        try {
40
        	sem--;
35 41
        	System.out.println("Numero de accesos: " + accesos);
42
        	if (sem == 0)
36 43
            driver.close();
37 44
        } catch (IOException e) {
38 45
            throw new DriverException(e);

Also available in: Unified diff