This content has been marked as final.
Show 4 replies
-
1. Re: storageManager.afterReplicated(..) and when and how to u
clebert.suconic Oct 26, 2009 2:08 PM (in response to ataylor)On PostOfficeimpl::processRoute, there is some code that will only add to the queue, after the storage is processed. If you just need to deliver after persistence, that code is already done.
But if your process is changing routing tables such as creating queues, etc, on this case you need to process the route only after the replication.. you should do something like this:if (storage.isReplicated()) { storage.afterReplicated(new runnable... etc... .doProcessroute()); } else { doProcessRoute(); } doProcessRoute() { binding.route(message, context); }
You should probably test for the exceptions before donig this call.
So, the key question here is... you need to deliver after replicated, or route after replicated? That depends on the use case. -
2. Re: storageManager.afterReplicated(..) and when and how to u
clebert.suconic Oct 26, 2009 2:08 PM (in response to ataylor)AddtoTheQueue implies deliver BTW.
-
3. Re: storageManager.afterReplicated(..) and when and how to u
clebert.suconic Oct 26, 2009 3:12 PM (in response to ataylor)shouldn't this call on LocalGroupHnadler be blocked somehow?
public Response propose(Proposal proposal) throws Exception { if(proposal.getClusterName() == null) { GroupBinding original = map.get(proposal.getGroupId()); return original == null?null:new Response(proposal.getGroupId(), original.getClusterName()); } GroupBinding groupBinding = new GroupBinding(proposal.getGroupId(), proposal.getClusterName()); if (map.putIfAbsent(groupBinding.getGroupId(), groupBinding) == null) { groupBinding.setId(storageManager.generateUniqueID()); groupMap.put(groupBinding.getClusterName(), groupBinding); storageManager.addGrouping(groupBinding); return new Response(groupBinding.getGroupId(), groupBinding.getClusterName()); } else { groupBinding = map.get(proposal.getGroupId()); return new Response(groupBinding.getGroupId(), proposal.getClusterName(), groupBinding.getClusterName()); } }
Ok, you're using a ConcurrentMap. That's not a problem. I'm referring to the journal operation. If you crashed here, you could already be already sending messages to the GroupBinding before the data is sync on disk.
It would be a rare race I know.. but it could happen. -
4. Re: storageManager.afterReplicated(..) and when and how to u
ataylor Oct 27, 2009 3:54 AM (in response to ataylor)shouldn't this call on LocalGroupHnadler be blocked somehow?
If you mean should i wait until the stotage managert call has completed until routing then yes, thats what i need to add. The point i was making is that if i route the messages in a different thread using after afterReplicated then the routing may get called after the server sesion calling thread has completed allowing another cann which may deliver a message or delete a binding or whatever. for now I will make this blocking and review later.