singleton like: new MyWebService() done a single time ;)

Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-06 19:08 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
> @Romain
>
> When you say singleton you mean a singleton that allows multiple threads to
> execute... much like @Singleton @Lock(READ) @WebService (except for the
> other EJB features that will open up) we talked about before right?
>
> Thanks
>
>
>
>
> On Sat, Sep 6, 2014 at 7:04 PM, Romain Manni-Bucau <[email protected]>
> wrote:
>
>> Hi
>>
>> yes by default model is singleton.
>>
>> about scopes: nothing explicit in the spec AFAIK, in tomee default is:
>> use cdi beans if possible so all scopes are possible (even session if
>> your client supports it!).
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-06 18:17 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
>> > Hi
>> >
>> > Thanks for the answers, see some follow up questions below.
>> >
>> >
>> >
>> >
>> > On Sat, Sep 6, 2014 at 1:20 PM, Jean-Louis Monteiro <
>> > [email protected]> wrote:
>> >
>> >> Hi,
>> >>
>> >> Le 6 sept. 2014 11:39, "Lars-Fredrik Smedberg" <[email protected]> a
>> >> écrit
>> >> :
>> >> >
>> >> > Hi!
>> >> >
>> >> > I've tried to look at JSR-299 CDI, JSR-318 EJB and JSR-109 Enterprise
>> Web
>> >> > Services (the ones we need to rely on)...
>> >> >
>> >> > I try to understand how I can combine EJB/CDI (is possible) with a
>> JAX-WS
>> >> > WebService, a @WebService annotated class... We are in production
>> >> currently
>> >> > on JavaEE 6.
>> >> >
>> >> > Questions/assumptions:
>> >> >
>> >> > - JSR-109 say that a JAX-WS WebService can also be a @Stateless or
>> >> > @Singleton EJB. The choice here would be if I need thread-safety or
>> not.
>> >> > Correct?
>> >>
>> >> Not only. Using CDI You can also use scopes for that. It's more related
>> to
>> >> additional services provided by ejb like transactions, security to name
>> a
>> >> few.
>> >>
>> >>
>> > So what CDI scopes can I annotate a @WebService with? What specification
>> > can I rely upon?
>> > I looked in 109, 299 etc and did not find anything?
>> >
>> >>
>> >> > - I did not see that I could annotated a Web Service with @Stateful?
>> My
>> >> > idea here was to create a @Stateful @SessionScoped/@RequesScoped
>> >> > @WebService but I guess that is outside the specs and possible outside
>> >> all
>> >> > appserver implementations, correct?
>> >>
>> >> Correct. Works with cxf under certain conditions.
>> >>
>> >
>> > What CDI scopes can be combinated with @WebService using CXF? Are all
>> > combinations of CDI scopes outside the specs?
>> >
>> >
>> >>
>> >> >
>> >> > - I assume that an alternative would be to Inject and use e.g.
>> >> > @SessionScoped bean in the webservice/ejb.... however I want to
>> explore
>> >> my
>> >> > possibilities.
>> >> >
>> >> > - Reading JSR-109 -5.3.2.4.2 I see the following: "A JAX-WS Service
>> >> > Endpoint can be single or multi-threaded." and "A container may use
>> any
>> >> > bean instance to service a request.". Does this mean that its up to
>> the
>> >> > JAX-WS implementation to pool instance or not and up to the
>> >> implementation
>> >> > if it chooses to let the same instance serve multiple requests
>> >> > concurrently? I talking about the case where I only annotate using
>> >> > @WebService, the
>> >> > web service is not an EJB in this case.
>> >>
>> >> Mainly depends on the backed bean you are choosing. Singleton stateless
>> etc
>> >>
>> >
>> > I was talking about the case where I only annotate with @WebService (no
>> > EJB, no CDI scopes etc).
>> > If I read the specification I understand that multiple threads can access
>> > the same web service instance. correct?
>> > How does CXF work here?
>> >
>> >
>> >>
>> >> > - JSR-109 talks about implementing "SingleThreadModel" and that its
>> >> > deprecated, are there any options to achieve the same without using a
>> >> > @Stateless @WebService?
>> >> >
>> >> > - When using JavaEE7 I can annotate any POJO with @Transactional and
>> for
>> >> > some use-cases I not need an EJB. Is there in JavaEE7 also some
>> options
>> >> to
>> >> > using @Stateless or @Singleton @WebService? Maybe using CDI scopes...
>> >> > however I not see anything about this in the CDI spec?
>> >> >
>> >> >
>> >> >
>> >> > Thanks
>> >> > Lars-Fredrik
>> >> >
>> >> > --
>> >> > Med vänlig hälsning / Best regards
>> >> >
>> >> > Lars-Fredrik Smedberg
>> >> >
>> >> > STATEMENT OF CONFIDENTIALITY:
>> >> > The information contained in this electronic message and any
>> >> > attachments to this message are intended for the exclusive use of the
>> >> > address(es) and may contain confidential or privileged information. If
>> >> > you are not the intended recipient, please notify Lars-Fredrik
>> Smedberg
>> >> > immediately at [email protected], and destroy all copies of this
>> >> > message and any attachments.
>> >>
>> >
>> >
>> >
>> > --
>> > Med vänlig hälsning / Best regards
>> >
>> > Lars-Fredrik Smedberg
>> >
>> > STATEMENT OF CONFIDENTIALITY:
>> > The information contained in this electronic message and any
>> > attachments to this message are intended for the exclusive use of the
>> > address(es) and may contain confidential or privileged information. If
>> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
>> > immediately at [email protected], and destroy all copies of this
>> > message and any attachments.
>>
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at [email protected], and destroy all copies of this
> message and any attachments.

Reply via email to