Package com.vmware.aurora.vc.vcevent.VcEventHandlers

Examples of com.vmware.aurora.vc.vcevent.VcEventHandlers.IVcEventHandler


   protected static final String ResourcePoolEvent = null;

   public VcEventRouter() {
      /* High level handler for external vm events. */
      VcEventListener.installExtEventHandler(vmEvents, new IVcEventHandler() {
         @Override
         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            // Event can be either VmEvent or EventEx (TODO: Explicitly check for
            // VM specific EventEx class usage? e.g. VcEventType.VmAppHealthChanged?)
            AuAssert.check(e instanceof VmEvent || e instanceof EventEx);
            ManagedObjectReference moRef = e.getVm().getVm();
            switch (type) {
            case VmRemoved: {
               VcCache.purge(moRef);
               ManagedObjectReference rpMoRef = VcCache.removeVmRpPair(moRef);
               if (rpMoRef != null) {
                  VcCache.refresh(rpMoRef);
               }
               return false;
            }
            case VmDisconnected:
            case VmConnected: {
               VcVirtualMachine vm = VcCache.getIgnoreMissing(moRef);
               if (vm == null) {
                  return false;
               }
               vm.update();
               break;
            }
            case VmResourcePoolMoved: {
               VmResourcePoolMovedEvent event = (VmResourcePoolMovedEvent) e;
               VcCache.refresh(event.getOldParent().getResourcePool());
               VcCache.refresh(event.getNewParent().getResourcePool());
               break;
            }
            case VmCreated: {
               VmCreatedEvent event = (VmCreatedEvent) e;
               VcVirtualMachine vm = VcCache.get(event.getVm().getVm());
               vm.refreshRP();
               break;
            }
            case HostRemoved: {
               logger.info("Host removed event received" + e);
            }
            }
            VcCache.refreshAll(moRef);
            return false;
         }
      });

      /* High level handler for external rp events. */
      VcEventListener.installExtEventHandler(rpEvents, new IVcEventHandler() {
         @Override
         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            ManagedObjectReference moRef =
                  ((ResourcePoolEvent) e).getResourcePool().getResourcePool();
View Full Code Here


    *
    * @param produceQueue
    */
   @Override
   public void produceEvent(final BlockingQueue<IEventWrapper> produceQueue) {
      VcEventListener.installExtEventHandler(vmEvents, new IVcEventHandler() {
         @Override
         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            logger.debug("Received external VM event " + e);
            add(type, e, true, produceQueue);
            return false;
         }
      });
      VcEventListener.installEventHandler(vmEvents, new IVcEventHandler() {
         @Override
         public boolean eventHandler(VcEventType type, Event e)
               throws Exception {
            logger.debug("Received internal VM event " + e);
            add(type, e, false, produceQueue);
View Full Code Here

TOP

Related Classes of com.vmware.aurora.vc.vcevent.VcEventHandlers.IVcEventHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.