Skip to content
Snippets Groups Projects
Commit 77bf98ef authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

removed a problem with a hanging thread

parent 99b17d07
Branches
No related tags found
No related merge requests found
......@@ -79,12 +79,13 @@ public class JamsCA implements CertificateAuthority {
crlLifetime = config.getCrlLifetime();
userLifetime = config.getUserLifetime();
deviceLifetime = config.getDeviceLifetime();
crlWorker = new CRLWorker(CA.getPrivateKey(), CA.getCertificate());
try {
ocspWorker = new OCSPWorker(OCSP.getPrivateKey(), OCSP.getCertificate(), crlWorker);
}
catch (Exception e){
log.error("Could not start OCSP request processor with error {}",e.getMessage());
if(ca != null && ocsp != null) {
crlWorker = new CRLWorker(CA.getPrivateKey(), CA.getCertificate());
try {
ocspWorker = new OCSPWorker(OCSP.getPrivateKey(), OCSP.getCertificate(), crlWorker);
} catch (Exception e) {
log.error("Could not start OCSP request processor with error {}", e.getMessage());
}
}
}
......
......@@ -51,7 +51,6 @@ public class CRLWorker extends X509Worker<RevocationRequest> {
public CRLWorker(PrivateKey privateKey, X509Certificate certificate) {
super(privateKey, certificate);
if(privateKey == null || certificate == null) return;
this.setDaemon(true);
this.start();
//TODO: The CRL needs to be loaded from memory
......
......@@ -86,7 +86,7 @@ public class AppStarter extends Thread {
doUpdate.wait();
}
if(doUpdate.get()){
Server.tomcatLauncher.stopTomcat();
server.tomcatLauncher.stopTomcat();
server = null;
//This will trigger a force reload of the lib.
LibraryLoader.loadlibs(System.getProperty("user.dir"), AppStarter.class);
......
......@@ -15,7 +15,6 @@
<groupId>net.jami</groupId>
<artifactId>cryptoengine</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
......@@ -36,25 +35,21 @@
<groupId>net.jami</groupId>
<artifactId>datastore</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.jami</groupId>
<artifactId>jams-common</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.jami</groupId>
<artifactId>jami-nameserver</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.jami</groupId>
<artifactId>jami-dht</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
......
......@@ -23,6 +23,11 @@
package net.jami.jams.server;
import com.jsoniter.JsonIterator;
import com.jsoniter.JsonIteratorPool;
import com.jsoniter.output.EncodingMode;
import com.jsoniter.output.JsonStream;
import com.jsoniter.spi.DecodingMode;
import com.jsoniter.spi.JsoniterSpi;
import lombok.extern.slf4j.Slf4j;
import net.jami.datastore.main.DataStore;
import net.jami.jams.common.authentication.AuthenticationSourceType;
......@@ -64,12 +69,11 @@ public class Server {
public static AppUpdater appUpdater;
public Server(AppUpdater appUpdater, String port, String serverCertificate, String serverPrivateKey) {
Runtime.getRuntime().gc();
Server.appUpdater = appUpdater;
JsoniterRegistry.initCodecs();
String[] args = {port, serverCertificate, serverPrivateKey};
if ((args.length > 0)) main(args);
else main(new String[]{});
main(args);
}
......
......@@ -51,7 +51,7 @@ import static net.jami.jams.server.Server.certificateAuthority;
@Slf4j
public class TomcatLauncher {
private Tomcat tomcat = new Tomcat();
private final Tomcat tomcat = new Tomcat();
public TomcatLauncher(int port) {
tomcat.getService().addConnector(TomcatConnectorFactory.getNoSSLConnector(port));
......@@ -109,7 +109,7 @@ public class TomcatLauncher {
tomcat.start();
//Try to pop-up Web-UI
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Desktop.getDesktop().browse(new URI("https://localhost:8080"));
Desktop.getDesktop().browse(new URI(tomcat.getConnector().getScheme() + "://localhost:8080"));
} else {
log.info("There is no graphical interface on this system - please connect remotely!");
}
......@@ -124,7 +124,6 @@ public class TomcatLauncher {
certificateAuthority.shutdownThreads();
tomcat.stop();
tomcat.destroy();
tomcat = null;
}
} catch (Exception e) {
log.info("Failed to stop tomcat server with error {}", e.getMessage());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment