提交 12400e6b authored 作者: LaughingMan's avatar LaughingMan

Move large chunk of code into its own method

上级 b80c3fb5
......@@ -136,6 +136,17 @@ public class CreateCluster extends Tool {
// so that data can't change while restoring the second database
statSource.execute("SET EXCLUSIVE 2");
try {
performTransfer(statSource, urlTarget, user, password, serverList);
} finally {
// switch back to the regular mode
statSource.execute("SET EXCLUSIVE FALSE");
}
}
}
private static void performTransfer(Statement statSource, String urlTarget,
String user, String password, String serverList) throws SQLException {
try (PipedReader pipeReader = new PipedReader()) {
/*
* Pipe writer is used + closed in the inner class, in a
......@@ -192,10 +203,6 @@ public class CreateCluster extends Tool {
}
} catch (IOException ex) {
throw new SQLException(ex);
} finally {
// switch back to the regular mode
statSource.execute("SET EXCLUSIVE FALSE");
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论