Page 1 of 1

Re: About Question enthuware.oce-ejbd.v6.2.364 :

Posted: Thu May 07, 2015 5:43 pm
by himaiMinh
I think option 2 , changing the bean into a singleton bean is a correct choice if we consider these reasons:
1. by default, the concurrency management is container managed concurrency. So, we don't need to explicitly specify that.
2. by default, all the methods of a singleton bean has a @Lock(WRITE)

So, without doing anything, just change the bean into a singleton bean, will make the bean
thread safe?

Re: About Question enthuware.oce-ejbd.v6.2.364 :

Posted: Thu May 07, 2015 8:27 pm
by admin
Saying "change it to a singleton" is not same as saying "just add @Singleton" to the bean. If the question said the later, your argument would be correct. But in case of the former, it is ambiguous because it doesn't say anything about concurrency management type.

Re: About Question enthuware.oce-ejbd.v6.2.364 :

Posted: Wed Dec 28, 2016 1:02 am
by Gerardo
Hi,

After seeing the example code now I have the following doubt:

What happens if I have the following modified code:

public interface SLRemote{
void process1();
void process2();
}

@Stateless
@Remote(SLRemote.class)
public class SLSBean {
public void process2() {
//valid code
}
//doesnt implement process1();
}

I know this will compile, but my doubt is:

¿Will this code deploy without errors?
¿Will I get an error when calling SLRemote.process2()?

Many Thanks in advance

Re: About Question enthuware.oce-ejbd.v6.2.364 :

Posted: Wed Dec 28, 2016 8:12 am
by admin
1. This depends on the container. Ideally, the container should check that the bean does not define the method required by the remote interface and should fail to deploy.
2. Yes, if it deploys, you will get an exception at run time.