number of Threads

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
henryb
Posts: 41
Joined: Mon Oct 29, 2012 3:16 pm

number of Threads

Post by henryb »

Hi there,
I have script which loads a country and then and then zooms in on an area (defined by a boundingbox) and If necessary changes the size of the display using the command:

activeDisplay().setDimensions(0,0, iWidth, IHeight);

The problem is that after I have called the above method a few times the threads connnected with the old display seem to hang around - and after say 15 calls the number of domant threads is ~ 10*15:
I have created a simple script that illustrates the problem. All you need to to specify a bundle and a log file.
You can also watch the thread number mount up using jconsole.

...Henry
Attachments
support.py
(794 Bytes) Downloaded 330 times
User avatar
Jon
Posts: 192
Joined: Fri Jan 09, 2009 8:44 pm
Location: Madison, WI

Re: number of Threads

Post by Jon »

Hello Henry,

Thanks for bringing this to our attention (and providing an example script!). I'm looking into it now.

Jon
User avatar
henryb
Posts: 41
Joined: Mon Oct 29, 2012 3:16 pm

Re: number of Threads

Post by henryb »

HI Jon,
did you manage to replicate the problem ?
I have seen the problem on my local machine and on our sever
...Henry

Code: Select all

import os
import logging
import sys
import time
homeDir=os.getenv("HOME")
print homeDir

def numThreads():
    numT=java.lang.management.ManagementFactory.getThreadMXBean().getThreadCount();
    return numT

logging.basicConfig(filename="/home/hmb/Documents/SURFTWEETER/support.log", filemode='w', level=logging.DEBUG);     
logging.debug("/**** log start ****/");


# Open the bundle and change the size of the display frame to 640 by 480
loadBundle("/home/hmb/Documents/SURFTWEETER/bundles/auswaveG2.mcv",None,500,400)
# pause()

for sizeY in range(400,500,10):
  logging.debug("total number of Threads=%d\n"% numThreads() );
  activeDisplay().setDimensions(0,0,500,(sizeY));


logging.debug("Final number of Threads=%d\n"% numThreads() );
logging.debug("/**** log end ****/");


User avatar
beckys
Posts: 172
Joined: Wed Jan 07, 2009 7:50 pm

Re: number of Threads

Post by beckys »

As Jon wrote in response to your other post, we've written this up as Inquiry 1679: http://mcidas.ssec.wisc.edu/inquiry-v/?inquiry=1679
Post Reply