Revision 5220
trunk/libraries/libGDBMS/src/main/java/com/hardcode/gdbms/engine/data/DataSourceFactory.java | ||
---|---|---|
3 | 3 |
import java.io.ByteArrayInputStream; |
4 | 4 |
import java.io.File; |
5 | 5 |
import java.io.IOException; |
6 |
import java.rmi.server.UID; |
|
6 | 7 |
import java.sql.Connection; |
7 | 8 |
import java.sql.SQLException; |
8 | 9 |
import java.sql.Statement; |
... | ... | |
107 | 108 |
* @return unique id |
108 | 109 |
*/ |
109 | 110 |
private String getUID() { |
110 |
String name = "gdbms" + System.currentTimeMillis(); |
|
111 |
|
|
112 |
while (tableSource.get(name) != null) { |
|
113 |
name = "gdbms" + System.currentTimeMillis(); |
|
114 |
} |
|
115 |
|
|
111 |
UID uid = new UID(); |
|
112 |
|
|
113 |
String name = "gdbms" + uid.toString(); |
|
116 | 114 |
return name; |
117 | 115 |
} |
118 |
|
|
116 |
|
|
119 | 117 |
/** |
120 | 118 |
* Removes all associations between names and data sources of any layer. |
121 | 119 |
*/ |
... | ... | |
1792 | 1790 |
* If drivers cannot free remote resources |
1793 | 1791 |
*/ |
1794 | 1792 |
public void finalize() throws SQLException, DriverException { |
1795 |
clearViews(); |
|
1796 |
|
|
1797 |
Connection c = java.sql.DriverManager.getConnection( |
|
1798 |
"jdbc:hsqldb:file:", "", ""); |
|
1799 |
Statement st = c.createStatement(); |
|
1800 |
st.execute("SHUTDOWN"); |
|
1801 |
st.close(); |
|
1802 |
c.close(); |
|
1793 |
finalizeThis(); |
|
1803 | 1794 |
} |
1795 |
|
|
1796 |
public void finalizeThis() { |
|
1797 |
try { |
|
1798 |
clearViews(); |
|
1799 |
} catch (Exception e) { |
|
1800 |
e.printStackTrace(); |
|
1801 |
} |
|
1802 |
|
|
1803 |
|
|
1804 |
try { |
|
1805 |
Connection c = java.sql.DriverManager.getConnection( |
|
1806 |
"jdbc:hsqldb:file:", "", ""); |
|
1807 |
Statement st = c.createStatement(); |
|
1808 |
st.execute("SHUTDOWN"); |
|
1809 |
st.close(); |
|
1810 |
c.close(); |
|
1811 |
} catch (Exception e) { |
|
1812 |
e.printStackTrace(); |
|
1813 |
} |
|
1814 |
|
|
1815 |
} |
|
1804 | 1816 |
|
1805 | 1817 |
/** |
1806 | 1818 |
* Initializes the system. |
Also available in: Unified diff