| In fact, this could be probably implemented using a javax.enterprise.context.Conversation decorator and Weld Context Mgmt API - see also the pseudo-code below:
@Priority(10) |
@Decorator |
abstract class ConversationDecorator implements Conversation { |
|
@Inject |
@Delegate |
Conversation delegate; |
|
@Inject |
HttpConversationContext context; |
|
public void begin() { |
Collection<ManagedConversation> conversations = context.getConversations(); |
if (conversations.size() > LIMIT) { |
// ...iterate over conversations and end() those whose match some conditions |
} |
delegate.begin(); |
} |
}
|
|