Remove JSch threading hack

Remove the hack that allows us to use JSch with Java 7 on App Engine -
basically, we have a modified version of JSch that lets us attach a
GAE-friendly thread factory and use that for all JSch threads.

TESTED: Verified that RDE SFTP uploads still work on alpha.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182208225
This commit is contained in:
mmuller 2018-01-17 06:58:42 -08:00 committed by Ben McIlwain
parent b6d2790a13
commit e3531e9f29

View file

@ -16,7 +16,6 @@ package google.registry.rde;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.appengine.api.ThreadManager;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import dagger.Module;
@ -33,7 +32,6 @@ public final class JSchModule {
@Config("rdeSshIdentity") String identity,
@Key("rdeSshClientPrivateKey") String privateKey,
@Key("rdeSshClientPublicKey") String publicKey) {
applyAppEngineKludge();
JSch jsch = new JSch();
try {
jsch.addIdentity(
@ -48,14 +46,4 @@ public final class JSchModule {
JSch.setConfig("StrictHostKeyChecking", "no");
return jsch;
}
/**
* Overrides the threadFactory used in JSch and disable {@link Thread#setName(String)} in order to
* ensure GAE compatibility. By default it uses the default executor, which fails under GAE. This
* is currently a Google-specific patch that needs to be sent upstream.
*/
private static void applyAppEngineKludge() {
JSch.threadFactory = ThreadManager.currentRequestThreadFactory();
JSch.useThreadNames = false;
}
}