Indeed, it's not required by the spec. 
But actually the only thing which makes sense is to *always* have Bean<T> also 
implements PassivationCapable.

All OpenWebBeans built-in beans are PassivationCapable.

LieGrue,
strub


> Am 08.02.2017 um 00:01 schrieb Romain Manni-Bucau <[email protected]>:
> 
> 
> 
> Le 7 févr. 2017 23:51, "Tamás Kimmel" <[email protected]> a écrit :
> Thanks for the answers.
> It was not clear to me bean passivation and instance serialization is totally 
> different stories.
> 
> It seems to me BeanManager stores all beans as PassivationCapable.
> Does beanManager.getBeans(anyclass) always return PassivationCapable bean(s) ?
> Ok, i feel it's implementation specific...
> 
> Doesnt have too.
> 
> 
> Thanks in advance,
> Kimmel Tamás
> 
> 
> 
> 2017-02-07 11:35 GMT+01:00 Mark Struberg <[email protected]>:
> Hi Tamás!
> 
> I strongly recommend that EVERY Bean<T> should implement PassivationCapable!
> 
> The reason is the following: we need that information to serialise the 
> proxies.
> 
> Consider you have an
> 
> @ApplicationScoped
> public class MailService {....}
> 
> Of course this class doesn't need to be Serializable, because it doesn't 
> leave the server, right?
> 
> Now you take a
> 
> @SessionScoped
> public class MailForm implements Serializable {
>  private @Inject MailService mailSvc;
> ...
> }
> 
> So the MailForm instances might get serialised to another node.
> With this the MailService Contextual Reference (the PROXY!) get's also 
> serialised along as well.
> 
> So while the MailService Contextual Instance (the actual 
> 'application-singleton') does NOT get serialised, the Contextual Reference 
> (the proxy) *will*.
> 
> That means that the Bean needs to be PassivationCapable.
> Ofc only the Bean<MailService>, not the Contextual Instance of the 
> MailService!
> 
> hth.
> 
> LieGrue,
> strub
> 
> 
> > Am 06.02.2017 um 22:12 schrieb Tamás Kimmel <[email protected]>:
> >
> > Hi.
> >
> > I'm experimenting with a custom cdi context.
> > I've found all Beans for non-Serializable classes are PassivationCapable ( 
> > org.apache.webbeans.component.ManagedBean).
> > getId returns an id, and beanManager.getPassivationCapableBean works on it.
> > - checked Weld, and works same too -
> > Are there any circumstances a Bean not instance of PassivationCapable?
> >
> > Is it something i can rely on?
> > For example use the passivation id for key in my contextual storage even 
> > for beans with non-serializable beanClasses.
> > I know bean classes, interceptors, and decorators have to be Serializable 
> > for a working passivation.
> >
> > Thanks in advance,
> > Kimmel Tamás
> >
> 
> 
> 

Reply via email to