public void handleNotification(Notification notification, Object handback) { try { String type = notification.getType(); if (NotificationType.GCMRuntimeRegistered.equals(type)) { if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Notification received"); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Notification received"); } GCMRuntimeRegistrationNotificationData data = (GCMRuntimeRegistrationNotificationData) notification.getUserData(); if (data.getDeploymentId() != listener.getDeployID()) { return; } if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Notification accepted"); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Notification accepted"); outDebug.flush(); } ProActiveRuntime childRuntime = data.getChildRuntime(); if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Creating Node"); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Creating Node"); } Node scilabNode = null; try { scilabNode = childRuntime.createLocalNode( nodeBaseName + "_" + nodeName + "_" + nodeCount, true, null, null); } catch (Exception e) { if (debug) { e.printStackTrace(); e.printStackTrace(outDebug); } throw e; } nodeCount++; if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Node Created : " + scilabNode.getNodeInformation().getURL()); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Node Created :" + scilabNode.getNodeInformation().getURL()); } listener.setNode(scilabNode); if (debug) { System.out.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Waking up main thread"); outDebug.println( "[" + new java.util.Date() + " " + host + " " + this.getClass().getSimpleName() + "] Waking up main thread"); } } } catch (Exception e) { e.printStackTrace(); if (debug) { e.printStackTrace(outDebug); } } finally { semaphore.release(); } }