Skip to content

Instantly share code, notes, and snippets.

@kazabubu
Created September 9, 2019 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazabubu/ffcdc774307abf810c0d3d80886e4f62 to your computer and use it in GitHub Desktop.
Save kazabubu/ffcdc774307abf810c0d3d80886e4f62 to your computer and use it in GitHub Desktop.
Killing TEZ Queries
public class PoolableRegisteredConnectionFactory extends PoolableConnectionFactory {
private ConnectionRegister connectionRegister;
@Override
public Object makeObject() throws Exception {
PoolableConnection conn = (PoolableConnection) super.makeObject();
if (connectionRegister != null) {
connectionRegister.register(conn);
}
return conn;
}
@Override
public void destroyObject(Object obj) throws Exception {
if (obj instanceof PoolableConnection) {
((PoolableConnection) obj).reallyClose();
if (connectionRegister != null) {
connectionRegister.unregister((PoolableConnection) obj);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment