return conn;
} else {
try {
wait(timeout);
if (new Date().getTime() - startTime >= timeout) {
throw new GFException("Getting connection timeout");
} else {
continue;
}
} catch (InterruptedException e) {
throw new GFException("The waiting thread is interrupted");
}
}
}
}