Skip to main content

Lg3D ExitEvent

3 replies [Last post]
radeczka
Offline
Joined: 2004-05-12
Points: 0

Hi,
I was working litlle bit around ExitEvent most time I was spend to design Client API (not to much) Now my code looks that

<br />
 LgEventConnector.getLgEventConnector().addListener(<br />
            LgEventSource.ALL_SOURCES,<br />
            new LgEventListener() {<br />
                public void processEvent(final LgEvent event) {<br />
                    LgExitEvent lgExit = (LgExitEvent)event;<br />
                    lgExit.putToSpooler(this);//register this class for wait lg3d with closing<br />
                   //  <---process exitEvent---><br />
                    lgExit.removeFromSpooler(this); //when precess goes well we call remove from exitEventSpooler<br />
                }<br />
                public Class[] getTargetEventClasses() {<br />
                    return new Class[] {LgExitEvent.class};<br />
                }<br />
            });<br />

It can be in that way ?? for me it is not very nice but if somebody got any sugestion I am witing for it. I don't touch any lg3d-core classes but only I added new ones Lg3dExitEvent and Lg3DExitEventSpooler and other with dialogs when something going wrong.

Radek

Message was edited by: radeczka

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hideya
Offline
Joined: 2003-07-22
Points: 0

Hi Radek,

Thanks for your consideration on the ExitEvent. Actually, implementing ExitEvent involves some trickiness (e.g. we need to deal with such a case where some ExitEvent handler keep running which prevents terminating LG3D).

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

Java implementers have seem to have given lots of thoughts when implementing java.lang.Runtime.addShutdownHook(), and I'm thinking that it can/should be used for LG3D apps when these need special treatment when LG3D gets shut down.

What do you think?

hideya

Radek Kierner

Hi Hideya,
Nice to see You back :) with some comments
> Thanks for your consideration on the ExitEvent. Actually, implementing ExitEvent involves some trickiness (e.g. we need to deal with such a case where some ExitEvent handler keep running which prevents terminating LG3D).
>
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
>
> Java implementers have seem to have given lots of thoughts when implementing java.lang.Runtime.addShutdownHook(), and I'm thinking that it can/should be used for LG3D apps when these need special treatment when LG3D gets shut down.
>
> What do you think?
>
Sounds great to me. I want only add some special lg3d actions for that
thread like deliver maximum execution time somehow. Propably all that
therds I will put to ThreadGroup and there should be more controled.
After I end work with BgManager I will back to this subject propably
next week.

Radek

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@lg3d.dev.java.net
For additional commands, e-mail: interest-help@lg3d.dev.java.net

hideya
Offline
Joined: 2003-07-22
Points: 0

Hi Radek,

> I want only add some special lg3d actions for that
thread like deliver maximum execution time somehow. Propably > all that
> therds I will put to ThreadGroup and there should be more controled.
> After I end work with BgManager I will back to this subject propably
> next week.

Sounds good. Thanks for your willingness to work on this issue. Let's first see if addShutdownHook() fulfills our requirements. If not, let's discuss how to answer the LG3D app specific requirements.

hideya