DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.

DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Since majority of time to access internal message bus data structure will be READs, MessageBusBase uses a special MessageBusBase.Gate to implement Read/Write lock behave for the sake of performance in multi-threaded running environment.
MessageSerializer
Message bus can be extended remotely, across management server within the cluster or even extend its boundary to remote agents. This can be achieved by plugging-in different MessageBus implementations. To make the whole system to be loosely coupled and be adaptive to implementation from non-Java environment, we need to define a common exchange ground for the on-wire format. MessageSerializer serves the purpose of this.
MessageHandler
Java annotation for subscriber to specify a message handler. Used together with MessageDispatcher. Message subscribers can declare a message handler in following pattern.
...
For message subscriber to use to dispatch received messages to annotated message handlers
MessageDetector
, the above example shows the use case from design point of view.
MessageDetector
Message bus pattern by nature conforms to event-driven programming model. However, due to the reason that we have a large amount of code base that follows synchronized programming model, we have considerable needs that most of time we need a mechanism to feed asynchronized event notification into a synchronized flow. Following is a typical usage pattern for such scenario.
| Code Block |
|---|
//
// TODO : this will be replaced with fully-asynchronized way later so that we don't need
// to wait here. The reason we do it synchronized here is that callers of advanceStart is expecting
// synchronized semantics
//
//
_jobMgr.waitAndCheck(
new String[] { TopicConstants.VM_POWER_STATE, TopicConstants.JOB_STATE },
3000L, 600000L, new Predicate() {
@Override
public boolean checkCondition() {
VMInstanceVO instance = _vmDao.findById(vm.getId());
if(instance.getPowerState() == VirtualMachine.PowerState.PowerOff)
return true;
VmWorkJobVO workJob = _workJobDao.findById(jobId);
if(workJob.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS)
return true;
return false;
}
}); |
_jobMgr.waitAndCheck relies on the service provided by MessageDetector. To fit into synchronized programming model, MessageDetector will block the execution until an interested event appears on the To detect interested messages on message bus.
...