#289 fix the error handling when xa transaction error in prepare

This commit is contained in:
sunzhengfang
2017-10-23 16:37:21 +08:00
parent ba13e797e5
commit 40bd1923fc
@@ -22,21 +22,21 @@ public class NewConnectionRespHandler implements ResponseHandler {
private ReentrantLock lock = new ReentrantLock();
private Condition initiated = lock.newCondition();
public BackendConnection getBackConn() throws IOException{
public BackendConnection getBackConn() throws IOException {
lock.lock();
try {
if (backConn == null) {
initiated.await();
}
if(backConn == null){
if (backConn == null) {
throw new IOException("get backend connection error ");
}
return backConn;
} catch (InterruptedException e) {
LOGGER.warn("getBackConn " + e);
return null;
} catch(IOException e){
throw e;
} catch (IOException e) {
throw e;
} finally {
lock.unlock();
}