Actions
RemoveTable JAVA¶
/**
* Remove table from synchronization
* @param tableName table name
* @throws Exception
*/
public void removeSynchrnizedTable(String tableName) throws Exception {
HttpURLConnection connection = null;
InputStream resultStream = null;
String resultString = null;
String requestUrl = String.format("%s/RemoveTable/%s", _serverURL, tableName);
try {
connection = (HttpURLConnection) new URL(requestUrl).openConnection();
int status = connection.getResponseCode();
switch (status){
case HttpURLConnection.HTTP_OK:
resultStream = connection.getInputStream();
resultString = IOUtils.toString(resultStream, "UTF-8");
break;
default:
resultStream = connection.getErrorStream();
resultString = IOUtils.toString(resultStream, "UTF-8");
throw new Exception(resultString);
}
}
finally {
if (resultStream != null) {
try {
resultStream.close();
} catch (IOException e) {
}
}
if (connection != null) {
connection.disconnect();
}
}
}
Updated by Tomek Dziemidowicz over 5 years ago · 1 revisions
Go to top