Jörg Budischewski ha scritto:
My platform is windows XP with java 1.5.0_06 and eclipse as a IDE.
The application is closed calling Runtime.getRuntime().halt(0);
have a look at these tools, tcpview.exe show what processes are
listening on which ports.
http://www.microsoft.com/technet/sysinternals/utilities/sysinternalssuite.mspx
Please try to use System.exit() and see, if it changes the behaviour.
If your process is still alive, you'll need to attach with a native
debugger to it, but you may only see something, when you have debug
enabled libraries.
Hi, I've already tried tcpview, and it shows a <non-existent> process
keeping the socket.
A profiler is giving me some more details: I've found some object which
remain instantiated and there are some thread owned by
OOoBean$EventListener.run() and java_remote_bridge$MessageDispatcher.run().
I think I have to kill these two threads, but I don't know how to do.
My bean is embedded into another class which extends Composite; the
class is named CExpOpenoffice.
CexpOpenoffice contains a :
Frame m_oContainer = SWT_AWT.new_Frame(this);
and then my bean instance :
m_oBean = new OOoBean();
then I add the bean to the frame:
m_oContainer.add(m_oBean);
In CExpOpenoffice I also create a context and a Listener for global events:
XComponentContext xRemoteContext =
m_oBean.getOOoConnection().getComponentContext();
Object xGlobalBroadCaster =
xRemoteContext.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.GlobalEventBroadcaster",
xRemoteContext);
xEventBroad =
(XEventBroadcaster)UnoRuntime.queryInterface(XEventBroadcaster.class,
xGlobalBroadCaster);
xEventBroad.addEventListener(new com.sun.star.document.XEventListener() {
public void notifyEvent(com.sun.star.document.EventObject oEvent) {
//O.log("Listener has received an event: " + oEvent.EventName);
XModel oModel =
(XModel)UnoRuntime.queryInterface(XModel.class,oEvent.Source);
String sUrl = "";
if (oModel!=null) {
//O.log("Model URL: " + oModel.getURL());
sUrl = oModel.getURL();
} else {
//O.log("Source model is null");
}
//inserisco l'evento nella coda
if (!m_messageQueue.offer(new QueuedMessage(sUrl,oEvent.EventName))) {
//O.log("Impossibile inserire nella coda il messaggio da Openoffice:
" + oEvent.EventName);
}
}
public void disposing(com.sun.star.lang.EventObject e) {
//O.log("On Dispose");
}
});
CExpOpenoffice implements DisposeListener, so that I can dispose the
bean and all related objects when the container is disposed:
public void widgetDisposed(DisposeEvent arg0) {
//O.log("CExpOpenOffice.widgetDispose: richiamo la closeDocument");
xEventBroad.removeEventListener(oOfficeListener);
try {
xContext = null;
m_oBean.clear();
} catch(Throwable oEx){
//O.log("CExpOpenOffice.widgetDispose: Eccezione: probabilmente il
documento era già chiuso");
oEx.printStackTrace();
}
try {
O.log("Widgetdisposed di CExpOpenOffice: termino desktop");
XDesktop oDesktop = m_oBean.getOOoDesktop();
if (oDesktop!=null) {
//O.log("Termino il desktop");
oDesktop.terminate();
//O.log("Widgetdisposed di CExpOpenOffice: terminato desktop");
}
} catch(Throwable oEx){
//O.log("CExpOpenOffice.widgetDispose: Eccezione nella
desktop.terminate");
oEx.printStackTrace();
}
try {
//O.log("Widgetdisposed di CExpOpenOffice: termino la connessione");
m_oBean.stopOOoConnection();
//O.log("Widgetdisposed di CExpOpenOffice: terminato la connessione");
} catch(Throwable oEx){
//O.log("CExpOpenOffice.widgetDispose: Eccezione nella
stopOOoConnection");
oEx.printStackTrace();
}
try {
//O.log("Widgetdisposed di CExpOpenOffice: distruggo container");
m_oContainer.dispose();
//O.log("Widgetdisposed di CExpOpenOffice: distrutto container");
} catch(Throwable oEx){
//O.log("CExpOpenOffice.widgetDispose: Eccezione nella
m_oContainer.dispose");
oEx.printStackTrace();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]