Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Static variables shared across instances #90

Closed
gmatht opened this issue Jun 1, 2017 · 1 comment
Closed

Static variables shared across instances #90

gmatht opened this issue Jun 1, 2017 · 1 comment

Comments

@gmatht
Copy link

gmatht commented Jun 1, 2017

Run directly under normal java the following code just outputs "Hello, World". When run under nailgun it prints an increasing number of "Worlds" each time it is run.

public class HelloWorld {
    static String x="Hello, ";
    public static void main(String[] args) {
        x=x+"World";
        System.out.println(x);
    }
}

I doubt this is a "code bug" that can be fixed, but is nevertheless a trap for the unwary that I think should be documented. It could also be documented that the main() function should be threadsafe as nailgun does not appear to serialize the requests but instead starts multiple threads at a time.

@jvican
Copy link
Contributor

jvican commented Jan 18, 2018

I bet this is fixed upstream, could be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants