conversations and destroy
egetezolt May 23, 2008 12:25 PMI have a problem destroying nested conversations and then get the ID of the other active conversation parent ID.
Here is the code I use:
public void killAllConversations() {
ConversationEntries conversationEntries = ConversationEntries.instance();
Set<ConversationEntry> conversationsSet = new TreeSet<ConversationEntry>();
conversationsSet.addAll(conversationEntries.getConversationEntries());
Iterator<ConversationEntry> conversationsIterator = conversationsSet.iterator();
Manager manager = Manager.instance();
while(conversationsIterator.hasNext()) {
ConversationEntry theConversation = conversationsIterator.next();
StringBuffer sb = new StringBuffer();
sb.append("\nCURRENT CONVERSATION ID FROM MANAGER = "+manager.getCurrentConversationId()+"\n");
sb.append("Destroying conversation with ID= "+theConversation.getId());
sb.append("\n--------------------------------------------------\nType= ");
sb.append(((theConversation.isNested()) ? "NESTED" : "NOT NESTED")+ "\n");
sb.append("Parent ID= "+manager.getParentConversationId() + "\n");
sb.append("ROOT conversation ID= "+manager.getRootConversationId() + "\n");
sb.append("\n\n");
System.out.println(sb.toString());
theConversation.destroy();
}
}When I start a new conversation with @Begin and then start two nested conversations the I get the following situation (let us persume the starting long running conversation has the ID=2 , the first nested ID=3 and the second nested ID=4)
for the first conversation (ID=2) I get parent ID=2, which is correct
for the second conversation (ID=3) I get parent ID=3, which is incorrect
for the third conversation (ID=4) I get parent ID=3, which is correct
It seams like after the destroy the last nested conversation is still active.
Am I doing something wrong here ?