Skip to content

Commit 81d5679

Browse files
committed
Clarify requirements of the Contexts SPI interface
1 parent 98ffc2f commit 81d5679

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

api/src/main/java/org/jboss/cdi/tck/spi/Contexts.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,22 @@ public interface Contexts<T extends Context> {
3434
public static final String PROPERTY_NAME = Contexts.class.getName();
3535

3636
/**
37-
* Sets the specified context as active
37+
* Sets the specified context as active.
38+
* <p>
39+
* If the context was previously set as inactive via {@link #setInactive(Context)}, this method is expected to
40+
* restore the state of the context, including all contextual instances that were previously in it.
41+
* <p>
42+
* If the context wasn't previously set as inactive, a new context is created and activated.
3843
*
3944
* @param context The context to set active
4045
*/
4146
public void setActive(T context);
4247

4348
/**
44-
* Sets the specified context as inactive
49+
* Sets the specified context as inactive; this operation does not destroy contextual instances.
50+
* <p>
51+
* Implementations need to store the context state as subsequent invocations of {@link #setActive(Context)} may
52+
* attempt to restore the context.
4553
*
4654
* @param context The context to set inactive
4755
*/

0 commit comments

Comments
 (0)