Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdi-dev] Spec question about application context
  • From: Benjamin Confino <BENJAMIC@xxxxxxxxxx>
  • Date: Thu, 29 Aug 2024 20:17:22 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uk.ibm.com; dmarc=pass action=none header.from=uk.ibm.com; dkim=pass header.d=uk.ibm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8XvnRCLSnmPZr2YzLvJ6oNPojSeOeDSaybquHtE/ru0=; b=VCOWiHjkON/tA3Zg3twv5gI8OjpPrm2MQaLKI2JDXkqhc3YM6PfrmhujmGZnj5Y55wqDAWfgsEt9oQ1f1OJ16JpayJ9ym9qoxmiHr9+Jv/Xe94nA3MtwuoB4okyJOIfxLpSO6rfa0aN1RU6rCXMEe3uKXvbH9Rt8p4A0tNHu14UsDw5JHZrz/PA8Yiq1UurAQPNSARZLbn6UYcTU3NSmx2CAhmnfuwxR59NABL3kEemqmmJXyXIxScTqMziMz897++AVp6W1OK6ICNyn4BvZKd2IMI9NBzT7q4g3phCyEd+F8I2KokgFgz8lTOemGtif8a2p8AwakN69gXyVuLHWHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sHHGuDKYmlNJyrHQdOwV+9CMQdm4ln+zB0VAmGBNZw70IksDSC9rYlH/aPdY0Sk1Jm8gp/N3M76nE8uvXPwaPdxxCt9+wWYrhvowknz3ePTqBMk9QRnAd2qT9J74Fuj+Bz2k6cuLutk514WbEmcD08rcN2kNEDj6S5O6WfXaX1erjlCG+DDq3VoMn4tjQpAr/YLl/wxt3w2XNT9ISpXT6fI79vljx5y28EA9VfWAJvFzML3QIcbsBwr6WNgSCez0RnilKt5oSdlw4msZWEY2is+OI+YaOUejdFi6iXUYnm/m7xZ9GaTcvnhxwkLGzzviCY30BFrjJm99B/FPwpUvfg==
  • Delivered-to: cdi-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/cdi-dev/>
  • List-help: <mailto:cdi-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/cdi-dev>, <mailto:cdi-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/cdi-dev>, <mailto:cdi-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHa+lBsAp9PaXAujkuRj/osYALytg==
  • Thread-topic: Spec question about application context

Hello

I recently had a customer ask me about CDI.current() in a multithreaded environment. In our webserver we set thread context that when an application invokes CDI.current() we know which application . However, propagating that context to a new thread requires an application to use an ManagedExecutorService or a similar technique. I did a quick santiy check against wildfly and I see that https://github.com/wildfly/wildfly/blob/main/weld/subsystem/src/main/java/org/jboss/as/weld/WeldProvider.java also has logic in getCDI() find the right instance of CDI.


My customer believes this is incorrect, and they say the spec just says (they referenced CDI-2.0 section 25.3.1) which says "A Java EE container is required to provide a CDI provider that will allow access to the current container for any Java EE application or Java EE module which contains enabled beans"

Their interpretation of this is that the spec beanmanager availability only depends on if we're calling CDI.current() within a Java EE application or Java EE module.

What does everyone think? Is it acceptable to depend on ManagedExecutorService to find the right instance of CDI?

Regards
Benjamin
Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU

Back to the top