Package com.sun.sgs.service

Examples of com.sun.sgs.service.TaskService


    }
      }
  }

  private void scheduleTask() {
      TaskService taskService =
    ChannelServiceImpl.getTaskService();
      if (isDurable) {
    taskService.scheduleTask(this, 1000L);
      } else {
    taskService.scheduleNonDurableTask(this, 1000L, true);
      }
  }
View Full Code Here


  implements RecoveryListener
    {
  /** {@inheritDoc} */
  public void recover(final Node node, SimpleCompletionHandler handler) {
      final long nodeId = node.getId();
      final TaskService taskService = getTaskService();
     
      try {
    if (logger.isLoggable(Level.INFO)) {
        logger.log(Level.INFO, "Node:{0} recovering for node:{1}",
             localNodeId, nodeId);
    }

    /*
     * Schedule persistent tasks to perform recovery.
     */
    transactionScheduler.runTask(
        new AbstractKernelRunnable("ScheduleRecoveryTasks") {
      public void run() {
          /*
           * For each session on the failed node, notify
           * the session's ClientSessionListener and
           * clean up the session's persistent data and
           * bindings.
           */
          taskService.scheduleTask(
        new HandleNextDisconnectedSessionTask(nodeId));
       
          /*
           * Remove client session server proxy and
           * associated binding for failed node, as
           * well as protocol descriptors for the
           * failed node.
           */
          taskService.scheduleTask(
        new RemoveNodeSpecificDataTask(nodeId));
      } },
        taskOwner);
              
    handler.completed();
View Full Code Here

    return;
      }

      WatchdogService watchdogService =
    ChannelServiceImpl.getWatchdogService();
      TaskService taskService = ChannelServiceImpl.getTaskService();
      BigInteger channelRefId = new BigInteger(channelIter.next());
      channelIter.remove();
      ChannelImpl channel = (ChannelImpl) getObjectForId(channelRefId);
      if (channel != null) {
    channel.reassignCoordinator(failedNodeId);
   
    /*
     * If other channel servers have failed, remove the failed
     * server node ID from the channel too.  This covers the
     * case where a channel coordinator (informed of a node
     * failure) fails before it has a chance to schedule a task
     * to remove the server node ID for another failed node
     * (cascading failure during recovery).
     */
    for (long serverNodeId : channel.getServerNodeIds()) {
        Node serverNode = watchdogService.getNode(serverNodeId);
        if (serverNode == null || !serverNode.isAlive()) {
      channel.removeServerNodeId(serverNodeId);
        }
    }
      }

      /*
       * Schedule a task to reassign the next channel coordinator, or
       * if done with coordinator reassignment, remove the recovered
       * node's  mapping from the node-to-event-queues map.
       */
      if (channelIter.hasNext()) {
    taskService.scheduleTask(this);
      }
  }
View Full Code Here

    }
      }
  }

  private void scheduleTask() {
      TaskService taskService =
    ChannelServiceImpl.getTaskService();
      if (isDurable) {
    taskService.scheduleTask(this, 1000L);
      } else {
    taskService.scheduleNonDurableTask(this, 1000L, true);
      }
  }
View Full Code Here

    return;
      }

      WatchdogService watchdogService =
    ChannelServiceImpl.getWatchdogService();
      TaskService taskService = ChannelServiceImpl.getTaskService();
      BigInteger channelRefId = new BigInteger(channelIter.next());
      channelIter.remove();
      ChannelImpl channel = (ChannelImpl) getObjectForId(channelRefId);
      if (channel != null) {
    channel.reassignCoordinator(failedNodeId);
   
    /*
     * If other channel servers have failed, remove the failed
     * server node ID from the channel too.  This covers the
     * case where a channel coordinator (informed of a node
     * failure) fails before it has a chance to schedule a task
     * to remove the server node ID for another failed node
     * (cascading failure during recovery).
     */
    for (long serverNodeId : channel.getServerNodeIds()) {
        Node serverNode = watchdogService.getNode(serverNodeId);
        if (serverNode == null || !serverNode.isAlive()) {
      channel.removeServerNodeId(serverNodeId);
        }
    }
      }

      /*
       * Schedule a task to reassign the next channel coordinator, or
       * if done with coordinator reassignment, remove the recovered
       * node's  mapping from the node-to-event-queues map.
       */
      if (channelIter.hasNext()) {
    taskService.scheduleTask(this);
      }
  }
View Full Code Here

TOP

Related Classes of com.sun.sgs.service.TaskService

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.