diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2021-08-12 09:28:04 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-08-29 05:02:59 -0400 |
commit | 6817b7e3b4ea55f896aeb07126cffea81abf901f (patch) | |
tree | 6714c996f78326401b8c8278344a1b6b57f0d48c /org.eclipse.jgit.pgm/src | |
parent | c697f02e1287fb1a9d215615a89233eff35fd9a4 (diff) | |
download | jgit-6817b7e3b4ea55f896aeb07126cffea81abf901f.tar.gz jgit-6817b7e3b4ea55f896aeb07126cffea81abf901f.zip |
Ignore IllegalStateException if JVM is already shutting down
Trying to register/unregister a shutdown hook when the JVM is already in
shutdown throws an IllegalStateException. Ignore this exception since we
can't do anything about it.
Bug: 575367
Change-Id: Ic967c16c7f566c84778795315ab369e76668b364
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index f70e72d434..600200d71d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -219,8 +219,12 @@ public abstract class TextBuiltin { case APACHE: { SshdSessionFactory factory = new SshdSessionFactory( new JGitKeyCache(), new DefaultProxyDataFactory()); - Runtime.getRuntime() - .addShutdownHook(new Thread(factory::close)); + try { + Runtime.getRuntime() + .addShutdownHook(new Thread(factory::close)); + } catch (IllegalStateException e) { + // ignore - the VM is already shutting down + } SshSessionFactory.setInstance(factory); break; } |