Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7EBAA200C27 for ; Sun, 26 Feb 2017 14:07:53 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7D549160B6E; Sun, 26 Feb 2017 13:07:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C8241160B59 for ; Sun, 26 Feb 2017 14:07:52 +0100 (CET) Received: (qmail 23867 invoked by uid 500); 26 Feb 2017 13:07:52 -0000 Mailing-List: contact dev-help@polygene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@polygene.apache.org Delivered-To: mailing list dev@polygene.apache.org Received: (qmail 23856 invoked by uid 99); 26 Feb 2017 13:07:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Feb 2017 13:07:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 97168183A61 for ; Sun, 26 Feb 2017 13:07:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.547 X-Spam-Level: X-Spam-Status: No, score=-1.547 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id madseqQCoYCv for ; Sun, 26 Feb 2017 13:07:50 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 9F6A15F2C5 for ; Sun, 26 Feb 2017 13:07:49 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id CB0C2E0534 for ; Sun, 26 Feb 2017 13:07:45 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3D7F524132 for ; Sun, 26 Feb 2017 13:07:45 +0000 (UTC) Date: Sun, 26 Feb 2017 13:07:45 +0000 (UTC) From: "Paul Merlin (JIRA)" To: dev@polygene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (POLYGENE-129) @PreDestroy and @PostConstruct in lieu of initializable and service activation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 26 Feb 2017 13:07:53 -0000 [ https://issues.apache.org/jira/browse/POLYGENE-129?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D15= 884741#comment-15884741 ]=20 Paul Merlin commented on POLYGENE-129: -------------------------------------- {{Initializable}} has a single {{initialize()}} method, called on fragment = instantiation ; the {{@PostConstruct}}=C2=A0semantic apply well here. {{Lifecycle}} has {{create()}} and {{remove()}} methods, called respectivel= y on *entities* creation and removal from UoW ; {{@PostConstruct}} and {{@= PreDestroy}} semantic apply well here too. {{@PreDestroy}} on a fragment would be ignored if not part of an entity {{Activation}} has {{activate()}} and {{passivate()}} methods ; the semanti= c here is that a passivated service can be reactivated ; {{@PreDestroy}} so= unds a bit aggressive in this context and {{@PostConstruct}} doesn't make s= ense for re-activation that happens on an existing instance. We should definitely replace {{Lifecycle}}=C2=A0and {{Initializable}} with = these annotations. I'm not sure about {{Activation}}, mostly because of semantics, any thought= s? > @PreDestroy and @PostConstruct in lieu of initializable and service activ= ation=20 > -------------------------------------------------------------------------= ------ > > Key: POLYGENE-129 > URL: https://issues.apache.org/jira/browse/POLYGENE-129 > Project: Polygene > Issue Type: Improvement > Reporter: Niclas Hedhman > > Kent wrote on mailing list; > {quote} > I agree that the mix and match between composites and mixin declarations = of the same @Activators concept might lead to confusion - not a good idea. > But a whole new thought .... aren't we reinventing the wheel here. > We have Initializable interface - declaring a method (on the mixin) invok= ed after construction. We have ServiceActivation - with 2 initialize/destro= y methods implemented by a mixin - and sort of referenced from the declarat= ions on the composites. > We have @Activators -- that may be declared on the composite - with wide = flexibility implementation-wise. > But .... the JDK already has @PostConstruct and @PreDestroy annotations. = These were originally JEE stuff, but have been in the JDK for several years= . And it is the same thing! Keeping a special Initializable interface is, f= rankly, a quite dated way of doing stuff. > I would say we should add support for declaring @PostConstruct and @PreDe= stroy on Mixins - and support for @PostConstruct on plain objects (instanti= ated by ObjectFactory). And simply remove (or just deprecate) Initializable= and ServiceActivation alltogether. > I am more uncertain whether the @Activators should be kept or not. On one= hand I cannot find a single usage in the whole codebase using beforeActiva= tion and afterPassivation - so not sure anyone would miss those features. > On the other hand it might be handy to be able to reuse the same activati= on logic across several composites - And there could be some potential of r= eusing the Activator as a listener for UnitOfWork activation/passivation in= stead of module activation/passivation. The afterPassivation could have som= e usages in that context. > So I think we should keep that concept for now. > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)