Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » PreDestroy not called
PreDestroy not called [message #1272155] Mon, 17 March 2014 07:49 Go to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi,

I've created a the following Xtend-class in my e4 application, that runs in compat mode:
@Creatable
class FileProvider {

	@Inject
	Logger logger

	@Inject
	new() {
	         // CALLED	
	}


	@PostConstruct
	def initialize() {
                // CALLED
	}

	@PreDestroy
	def cleanup() {
		// NOT CALLED
	}

}


I added it via ContextInjectionFactory.make(FileProvider.class, context);. The package javax.annotation (1.1.0) is also specified in the manifest.

Has anyone an idea what might cause this?

Best regards and thanks for any kind of help.
Bastian
Re: PreDestroy not called [message #1272298 is a reply to message #1272155] Mon, 17 March 2014 15:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
did you dispose the context?

To

On 17.03.14 00:49, Bastian Wagenfeld wrote:
> Hi,
>
> I've created a the following Xtend-class in my e4 application, that runs
> in compat mode: @Creatable
> class FileProvider {
>
> @Inject
> Logger logger
>
> @Inject
> new() {
> // CALLED
> }
>
>
> @PostConstruct
> def initialize() {
> // CALLED
> }
>
> @PreDestroy
> def cleanup() {
> // NOT CALLED
> }
>
> }
>
> I added it via ContextInjectionFactory.make(FileProvider.class,
> context);. The package javax.annotation (1.1.0) is also specified in the
> manifest.
>
> Has anyone an idea what might cause this?
>
> Best regards and thanks for any kind of help.
> Bastian
>
Re: PreDestroy not called [message #1272538 is a reply to message #1272298] Tue, 18 March 2014 06:31 Go to previous messageGo to next message
Bastian Wagenfeld is currently offline Bastian WagenfeldFriend
Messages: 183
Registered: January 2013
Senior Member
Hi Thomas,

not that I'd know... If there isn't any other way to dispose it other than calling context.dispose(), I did not.

Best regards
Bastian
Re: PreDestroy not called [message #1272565 is a reply to message #1272538] Tue, 18 March 2014 08:10 Go to previous messageGo to next message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
I have a similar (the same?) problem. My PreDestroy is also not called. I annotated my class in a similar way and used the correct make() call. When calling context.dispose(), the disposal is triggered, but no PreDestroy is called.

Please shed some light in here because I want to use it "the correct way".

EDIT: Turned out that I forgot javax.annotation in the "Imported packages." It works now.

[Updated on: Tue, 18 March 2014 09:34]

Report message to a moderator

Re: PreDestroy not called [message #1272687 is a reply to message #1272565] Tue, 18 March 2014 13:57 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Can you show me your Bean? If you only use postconstruct and constructor
injection you might be running into
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430041

Tom

On 18.03.14 01:10, Jens Rabe wrote:
> I have a similar (the same?) problem. My PreDestroy is also not called.
> I annotated my class in a similar way and used the correct make() call.
> When calling context.dispose(), the disposal is triggered, but no
> PreDestroy is called.
>
> I currently need to use a bad hack using restricted APIs where I cast my
> IEclipseContext do EclipseContext and attach an IContextDisposalListener
> via context.notifyOnDisposal().
>
> Please shed some light in here because I want to use it "the correct way".
Re: PreDestroy not called [message #1272692 is a reply to message #1272155] Tue, 18 March 2014 14:11 Go to previous message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
As I already stated, I forgot to include javax.annotation in the dependencies. I added this and it now works.
Previous Topic:org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler
Next Topic:Product run differs from development run
Goto Forum:
  


Current Time: Tue Apr 16 22:39:21 GMT 2024

Powered by FUDForum. Page generated in 0.39371 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top