fix stupid mistake in matrix plugin i made yesterday :(

This commit is contained in:
Strong Liu 2011-10-25 13:46:10 +08:00
parent b31c17b332
commit 33488cb2da
2 changed files with 7 additions and 4 deletions

View File

@ -35,6 +35,7 @@ class DBAllocation {
private UUID = "" private UUID = ""
private ant private ant
private File dbConfigFile; private File dbConfigFile;
private File tmpFile;
private String requestee; private String requestee;
def DBAllocation(dbinstallPath) { def DBAllocation(dbinstallPath) {
@ -45,6 +46,7 @@ class DBAllocation {
this.ant = ant; this.ant = ant;
this.dbinstallPath = dbinstallPath; this.dbinstallPath = dbinstallPath;
this.dbConfigFile = new File(dbinstallPath, outPropsFileName); this.dbConfigFile = new File(dbinstallPath, outPropsFileName);
this.tmpFile = new File(dbinstallPath, "tmpfile")
if ( System.properties.containsKey("hibernate-matrix-dballocation-requestee") ) if ( System.properties.containsKey("hibernate-matrix-dballocation-requestee") )
requestee = System.properties["hibernate-matrix-dballocation-requestee"] requestee = System.properties["hibernate-matrix-dballocation-requestee"]
else else
@ -87,7 +89,7 @@ class DBAllocation {
def release(UUID) { def release(UUID) {
println 'De-allocating DB...' println 'De-allocating DB...'
def allocatorUrl = DB_ALLOCATOR_URL + "?operation=dealloc&uuid=$UUID" def allocatorUrl = DB_ALLOCATOR_URL + "?operation=dealloc&uuid=$UUID"
ant.get(src: allocatorUrl, dest: "/tmp/.tmpfile") ant.get(src: allocatorUrl, dest: tmpFile.absolutePath)
} }
def clean() { def clean() {
@ -97,7 +99,7 @@ class DBAllocation {
def clean(UUID) { def clean(UUID) {
println 'Cleaning DB...' println 'Cleaning DB...'
def allocatorUrl = DB_ALLOCATOR_URL + "?operation=erase&uuid=$UUID" def allocatorUrl = DB_ALLOCATOR_URL + "?operation=erase&uuid=$UUID"
ant.get(src: allocatorUrl, dest: "/tmp/.tmpfile") ant.get(src: allocatorUrl, dest: tmpFile.absolutePath)
} }
def reallocate(newExpiry) { def reallocate(newExpiry) {
@ -107,7 +109,7 @@ class DBAllocation {
def reallocate(UUID, newExpiry) { def reallocate(UUID, newExpiry) {
println 'Re-allocating DB...' println 'Re-allocating DB...'
def allocatorUrl = DB_ALLOCATOR_URL + "?operation=realloc&uuid=$UUID&expiry=$newExpiry" def allocatorUrl = DB_ALLOCATOR_URL + "?operation=realloc&uuid=$UUID&expiry=$newExpiry"
ant.get(src: allocatorUrl, dest: "/tmp/.tmpfile") ant.get(src: allocatorUrl, dest: tmpFile.absolutePath)
} }
} }

View File

@ -81,7 +81,7 @@ public class DBAllocationHelper {
} }
private static String getURLPostfix(String dbName) { private static String getURLPostfix(String dbName) {
for ( String key: System.properties ) { for ( String key: System.properties.keySet() ) {
if ( key.startsWith(DB_ALLOCATION_URL_POSTFIX) ) { if ( key.startsWith(DB_ALLOCATION_URL_POSTFIX) ) {
String db = key.substring(DB_ALLOCATION_URL_POSTFIX.length() + 1, key.length()) String db = key.substring(DB_ALLOCATION_URL_POSTFIX.length() + 1, key.length())
if ( db.equalsIgnoreCase(dbName) ) { if ( db.equalsIgnoreCase(dbName) ) {
@ -94,6 +94,7 @@ public class DBAllocationHelper {
} }
} }
} }
return ""
} }
/** /**
* use -Dhibernate-matrix-dballocation=all to enable DBAllocation for all matrix node * use -Dhibernate-matrix-dballocation=all to enable DBAllocation for all matrix node