Problems in Network Chart Generation
Nilesh
niluforalways at yahoo.com
Tue Oct 9 06:26:26 UTC 2007
I am using jboss 4.2, java5.0 and RedHat Linux
Enterprise Version 4.0 with kernel 2.6 and NPTL 2.3.4
I am using open source network chart generation API
provided by geosoft ( http://geosoft.no/graphics/).
This API generates chart into swing window.
I wrote the code to change this swing window into web
browser compatible jpeg image. I used thread to
generate the image. It is working fine, for one user
and no other processes running on the application.
ISSUE:-
When more than 5 users hit the application at the same
time, some images get generated, some donot, there is
no fixed trend to this image generation process. I
analyzed CPU timing, it is using 100% CPU and after
the images are generated / not generated, the CU
usage goes down to zero.
When I used the same code with Linux 9.0 (kernel 2.4,
NPTL 0.6), rest remain the same, it is working
perfectly fine with more than 10 users, with all
images being generated, only that it is a lil slower.
Can somebody help me out to figure out whether it is a
kernel issue / NPTL issue? Does it have something to
do with thread processing?
Code for network chart generation :-
NetworkGenerator ntw=new NetworkGenerator();
BufferedImage img;
ntw.setVectRootNodes(vectRootNodes);
ntw.setHashChildNodeNames(hashNodeData);
ntw.setHashNodeRelation(hashNodeRelation);
ntw.setHashNodesCreated(hashNodesCreated);
ntw.setSupplyChainBean(supplyChainBean);
Thread t=new Thread(ntw);
t.setPriority(Thread.MAX_PRIORITY);
t.start();
try{
t.join();
}
catch(Exception e)
{
DebugManager.doDebug(className.toString(),e);
}
if(t!=null)
{
System.out.println(t.getState().name());
System.out.println(t.isAlive());
}
public class NetworkGenerator extends JFrame
implements Runnable{
public void run()
{
//call the garbage collector
System.gc();
// Create the graphic canvas
window = new no.geosoft.cc.graphics.GWindow();
window.getCanvas().setSize(screenWidth,screenHt );
// Create the GUI
JPanel topLevel = new JPanel();
topLevel.setBackground(new Color(255,255,255))
;
topLevel.setLayout (new BorderLayout());
getContentPane().add (topLevel);
topLevel.add (window.getCanvas(),
BorderLayout.CENTER);
topLevel.setVisible(true);
// Create scene with default viewport
scene = new
no.geosoft.cc.graphics.GScene(window, "My Scene"+ (new
Date().getTime()));
no.geosoft.cc.graphics.GStyle style = new
no.geosoft.cc.graphics.GStyle();
style.setForegroundColor (new Color (0, 0,
0));
style.setBackgroundColor (new Color (255, 255,
255));
style.setFont (new Font ("Arial", Font.BOLD,
10));
scene.setStyle (style);
int xPos=minY ;
int yPos=0;
int noofChild=vectRootNodes.size();
int dev=(screenHt -minY )/(noofChild+1);
int newDev=Math.round(dev-(dev/5));
//log.debug("---------noofChild-----------------------------------"+noofChild);
if(!hashNodesCreated.isEmpty())
{
for(int i=0;i<noofChild;i++)
{
yPos=minY +(dev*(i+1));
String nodeName =
vectRootNodes.get(i).toString();
log.debug("root
nodename===="+nodeName+" with ypos :"+yPos);
//log.debug("nodeName=="+nodeName);
//create root nodes
Node rootNode = createChildNode(
nodeName,minY,screenHt,xPos, yPos ,newDev,1);
scene.add(rootNode);
}
}
log.debug("screenWidth ===="+screenWidth );
// if(screenWidth>minExtXval)
// minExtXval = screenWidth;
// w2 o
// * |
// * |
// * |
// * w0 o-------o w1
double w0[] = {0.0,screenHt ,0.0};
double w1[] = {screenWidth,screenHt,0.0};
double w2[] = {0.0,0.0,0.0};
scene.setWorldExtent (w0, w1, w2);
this.pack();
}
}
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
More information about the redhat-list
mailing list