|
Re: platform startup and shutdown [message #524424 is a reply to message #524246] |
Wed, 31 March 2010 20:54 |
|
Alessio,
Can you test this with BIRT 2.5.2?
or email me the code to test?
Jason
Alessio Lai wrote:
> Hi , using BIRT version 2.2.2.
>
> We have integrated the report engine in our web application.
> We have recently built a page where is possible to monitor the status of
> the report engine and/or start it or shut it down with a mouse click.
>
> I've used the same API call suggested in this
> http://www.eclipse.org/birt/phoenix/deploy/reportEngineAPI.p hp
>
> If I profile the webApp when I start the report engine ,using
> Platform.startup(config) and factory.createReportEngine(config); I
> notice that the used permgen increases by some space, and that's ok ,
> it's expected. When I destroy the report engine and shutdown the
> platform , the permgen increase again .
> If I force a gc after platform shutdown the permgen doesn't decrease.
>
> And now there is the real issue : If I start again the report engine the
> permgen increase again the same of the first time I've started it up.
> If I repeat the operation for a lot of times I fill the permgenspace
> with the classic error , despite its size.....
> What I am doing wrong ?
>
> Thanks for any response.
>
> Alessio
>
>
>
>
>
>
|
|
|
Re: platform startup and shutdown [message #524509 is a reply to message #524424] |
Thu, 01 April 2010 08:23 |
Alessio Lai Messages: 2 Registered: March 2010 |
Junior Member |
|
|
Hi Jason , thank you for your response.
I've tried with version 2.5.2 as you suggested , and the problem is vanished. All data also in the permgen space is succsfully dereferenced.
I've tried with the below working example.
Thanks again.
Alessio
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.IPlatformContext;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.core.framework.PlatformFileContext;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
/**
*
* @author Alessio
*/
public class BirtShutdownTest {
private IReportEngine reportEngine;
private JTextArea log;
private String engineHome;
public BirtShutdownTest(String[] argv) {
if (argv.length != 1) {
System.out.println("Usage : BirtShutdownTest pathToReportEngine");
System.exit(0);
}
initSwingComponents();
//path to the report engine
engineHome = argv[0];
}
public static void main(String[] argv) {
new BirtShutdownTest(argv);
}
private void initSwingComponents() {
JFrame frame = new JFrame("Birt shutdown test");
JPanel northPanel = new JPanel();
JPanel centerPanel = new JPanel();
northPanel.setLayout(new FlowLayout());
centerPanel.setLayout(new FlowLayout());
JButton start = new JButton("Start Report engine");
JButton stop = new JButton("Stop report engine");
JButton gc = new JButton("Suggest a garbage collection");
frame.getContentPane().setLayout(new BorderLayout());
northPanel.add(start);
northPanel.add(stop);
northPanel.add(gc);
northPanel.setVisible(true);
frame.add(northPanel, BorderLayout.NORTH);
frame.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
});
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
EngineConfig config = new EngineConfig();
config.setEngineHome(engineHome);
IPlatformContext context = new PlatformFileContext(config);
config.setPlatformContext(context);
log.append("Trying to start BIRT Platform...\n");
try {
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_ REPORT_ENGINE_FACTORY);
reportEngine = factory.createReportEngine(config);
log.append("BIRT Platform successfully started.\n");
} catch (BirtException ex) {
log.append(ex.getMessage() + "\n");
Logger.getLogger(BirtShutdownTest.class.getName()).log(Level .SEVERE, null, ex);
}
}
});
stop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (reportEngine == null) {
return;
}
reportEngine.destroy();
Platform.shutdown();
reportEngine = null;
}
});
gc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.gc();
}
});
log = new JTextArea();
frame.getContentPane().add(log, BorderLayout.CENTER);
frame.setSize(new Dimension(600, 400));
frame.setVisible(true);
}
}
[Updated on: Thu, 01 April 2010 14:49] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03094 seconds