Home > Software engineering >  static class'member across threads after redeploy web app (java web-app, jboss4)
static class'member across threads after redeploy web app (java web-app, jboss4)

Time:02-21

In a web app a class is defined so:

public class ThreadSession {
private static final int MAX_AVAILABLE = 1;
static private final Semaphore semaphore = new Semaphore(MAX_AVAILABLE, true);

then there's one or more threads created by:

class wsClientThread extends Thread {
public void run() { ... }

...

wsClientThread clientThread = new wsClientThread(clientSocket);
clientThread.start();

let's call these thread A, B, ..

Inside these threads accessing to ThreadSession.semaphore work fine as expected, but after redeployed the web-app (by jboss 4.05), and reload my index.jsp, inside thread A, B,.. ThreadSession.semaphore is null (but ThreadSession.MAX_AVAILABLE = 1)

Cannot understand why this .. can anyone help me ?

Thx Cristian

CodePudding user response:

After several tests the problem was disappears I think it was caused by some instability in the application server (jboss 4)

  • Related