I have a server environment where there are multiple Jython interpreter instances. Since I need to distinguish output coming from each, I've made my custom OutputStream class.

PyFile myOut = new PyFile(new PyscripterOutputStream(this));
myOut.encoding = "UTF-8";
pyint.setOut(myOut);

However, I've found out that each next call to pyint.setOut() overrides the output streams of the previously initialized interpreter instances. As if that would be a global setting, not an individual one.

Any ideas what's going on?