org.beanlet
Annotation Type Stateful


@ScopeAnnotation
@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface Stateful

Stateful beanlet maintain conversational state between calls on the same object. Stateful beanlets do not provide direct access to the underlying objects. Instead, clients obtain a stub that delegates invocations to the underlying instance. In case of stateful beanlets, the stub always delegates invocation to the same instance.
A new beanlet instance is created for each beanlet that is explicitely requested throuh the APIs, or implicitely through dependency injection.
Stateful beanlets are non reentrant by default, which means that only one thread can invoke a method of the beanlet instance at the same time. This feature is provided by the stub, which controls all access to the underlying instance. Stateful beanlets can also be configured to be reentrant.

XML Representation

The following xml-fragment shows how to express this annotation in xml. The 'stateful' tag does not specify any element attribute, which means that this tag is applied to the beanlet's class. The attribute can be specified optionally if the annotation specifies a default value for the particular annotation method.
<beanlets xmlns="http://beanlet.org/schema/beanlet"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://beanlet.org/schema/beanlet http://beanlet.org/schema/beanlet/beanlet_1_0.xsd">
  <beanlet name="foo" type="com.acme.Foo">
    <stateful reentrant="false"/>
  </beanlet>
</beanlets>

See Also:
Stateless, ScopeAnnotation

Optional Element Summary
 boolean reentrant
          Specifies whether the beanlet instances should be reentrant or not.
 

reentrant

public abstract boolean reentrant
Specifies whether the beanlet instances should be reentrant or not. Instances of reentrant beanlets can be invoked by multiple threads at the same time.

Default:
false


Copyright © 2006-2012. All Rights Reserved.