Package org.nebulaframework.grid.service.event

Examples of org.nebulaframework.grid.service.event.ServiceHookCallback


        }
      }
    }).start();
   
    // Job End Hook to Execute Job End Actions
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

      public void onServiceEvent(final ServiceMessage event) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
           
View Full Code Here


    // Peer Clusters
    final JLabel clusters = getUIElement("general.stats.peerclusters");
    clusters.setText("0");
   
    // Peer Clusters Update Hook
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {
      public void onServiceEvent(ServiceMessage message) {
       
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            try {
              int peers = ClusterManager.getInstance().getPeerService().getPeerCount();
              clusters.setText(String.valueOf(peers))
            } catch (Exception e) {
              log.warn("[UI] Exception while accessing peer information",e);
            }
          }
        });
      }
    }, ServiceMessageType.PEER_CONNECTION, ServiceMessageType.PEER_DISCONNECTION);
   
    // Local Nodes
    final JLabel nodes = getUIElement("general.stats.nodes");
    nodes.setText(String.valueOf(ClusterManager.getInstance().getClusterRegistrationService().getNodeCount()));
   
   
    // Local Nodes Update Hook
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {
      public void onServiceEvent(ServiceMessage message) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            int count = ClusterManager.getInstance().getClusterRegistrationService().getNodeCount();
            nodes.setText(String.valueOf(count));
          }
        });
      }
    }, ServiceMessageType.NODE_REGISTERED, ServiceMessageType.NODE_UNREGISTERED);
   
    // Completed Jobs
    final JLabel jobsdone = getUIElement("general.stats.jobsdone");
    jobsdone.setText("0");
   
    // Completed Jobs Update Hook
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {
      public void onServiceEvent(ServiceMessage message) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            int count = ClusterManager.getInstance().getJobService().getFinishedJobCount();
            jobsdone.setText(String.valueOf(count));
          }
        });
      }
    }, ServiceMessageType.JOB_END, ServiceMessageType.JOB_CANCEL);
   
   
    // Active Jobs
    final JLabel activejobs = getUIElement("general.stats.activejobs");
    activejobs.setText(String.valueOf(ClusterManager.getInstance().getJobService().getActiveJobCount()));
   
    // Active Jobs Update Hook
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {
      public void onServiceEvent(ServiceMessage message) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            int count = ClusterManager.getInstance().getJobService().getActiveJobCount();
            activejobs.setText(String.valueOf(count));
View Full Code Here

     
      sw.stop();
      log.info("GridNode Started Up. " + sw.getLastTaskTimeMillis() + " ms");
     
      GridNode node = (GridNode) applicationContext.getBean("localNode");
      ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

        @Override
        public void onServiceEvent(ServiceMessage message) {
         
          log.warn("[GridNode] Disconnected from Cluster");
View Full Code Here

       
        // Register in Colombus Service
        mgr.registerCluster(serviceIP);

        // Register for Cluster Shutdown Event to Unregister Cluster
        ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

          @Override
          public void onServiceEvent(ServiceMessage event) {
            mgr.unregisterCluster(serviceIP);
          }
View Full Code Here

   * @param container Container to be shutdown (can be {@code null})
   *
   * @return ServiceHookCallback
   */
  private static ServiceHookCallback createRemoveQueueCallback(final String queueName, final DefaultMessageListenerContainer container) {
    ServiceHookCallback callback = new ServiceHookCallback() {
      public void onServiceEvent(ServiceMessage message) {
        if (container != null) container.shutdown();
        JMSResourceSupport.removeQueue(queueName);
      }
     
View Full Code Here

   * @param topicName Topic to be removed
   *
   * @return ServiceHookCallback
   */
  private static ServiceHookCallback createRemoveTopicCallback(final String topicName) {
    ServiceHookCallback callback = new ServiceHookCallback() {

      public void onServiceEvent(ServiceMessage message) {
        JMSResourceSupport.removeTopic(topicName);
      }
     
View Full Code Here

   *
   * @return ServiceHookCallback
   */
  private static ServiceHookCallback createShutdownContainerCallback(
      final DefaultMessageListenerContainer container) {
    ServiceHookCallback callback = new ServiceHookCallback() {

      public void onServiceEvent(ServiceMessage message) {
        try {
          if (container!=null) container.shutdown();
        } catch (JmsException e) {
View Full Code Here

      this.bytes = bytes;
      this.name = name;
      this.jobId = jobId;
     
      // Cleanup Hook
      ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

        public void onServiceEvent(ServiceMessage message) {
          log.debug("[ClassLoadingService] Removed class from cache : " + name);
          cache.remove(name);
        }
View Full Code Here

       
      });
    }
   
    // Job End / Cancel Hook to update finished flag
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {

      @Override
      public void onServiceEvent(ServiceMessage message) {
        jobFinished = true;
      }
View Full Code Here

TOP

Related Classes of org.nebulaframework.grid.service.event.ServiceHookCallback

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.