public void notifyListeners(Packet packet) { String id = (String) toObject(packet.getKey()); int i = (Integer) toObject(packet.getValue()); InstanceEvent.InstanceEventType instanceEventType = (i == 0) ? InstanceEvent.InstanceEventType.CREATED : InstanceEvent.InstanceEventType.DESTROYED; InstanceEvent event = new InstanceEvent(instanceEventType, (Instance) client.getClientProxy(id)); for (final InstanceListener listener : instanceListeners) { switch (instanceEventType) { case CREATED: listener.instanceCreated(event); break; case DESTROYED: listener.instanceDestroyed(event); break; default: break; } } }
@Override public void instanceCreated( InstanceEvent event ) { Instance instance = event.getInstance(); logger.info( "Created instance ID: [{}] Type: [{}]", instance.getId(), instance.getInstanceType() ); }
@Override public void instanceDestroyed( InstanceEvent event ) { Instance instance = event.getInstance(); logger.info( "Destroyed instance ID: [{}] Type: [{}]", instance.getId(), instance.getInstanceType() ); }
@Override public void instanceCreated( InstanceEvent event ) { Instance instance = event.getInstance(); logger.info( "Created instance ID: [" + instance.getId() + "] Type: [" + instance.getInstanceType() + "]" ); }
@Override public void instanceDestroyed( InstanceEvent event ) { Instance instance = event.getInstance(); logger.info( "Destroyed isntance ID: [" + instance.getId() + "] Type: [" + instance.getInstanceType() + "]" ); }