Package com.sun.sgs.service

Examples of com.sun.sgs.service.TaskService


    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 their sessions
     * 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 member sessions for
     * another failed node (cascading failure during recovery).
     */
    for (long serverNodeId : channel.getMemberNodeIds()) {
        Node serverNode = watchdogService.getNode(serverNodeId);
        if (serverNode == null || !serverNode.isAlive()) {
      channel.removeSessionSet(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


      if (iter == null || !iter.hasNext()) {
    return;
      }
     
      BigInteger channelRefId = new BigInteger(iter.next());
      TaskService taskService = ChannelServiceImpl.getTaskService();
      taskService.scheduleTask(
    new RemoveFailedSessionsFromChannelTask(
        failedNodeId, channelRefId));
       
      // Schedule a task to remove failed sessions from next
      // locally coordinated channel.
      if (iter.hasNext()) {
    taskService.scheduleTask(this);
      }
  }
View Full Code Here

  public void run() {
      DataService dataService =
    ClientSessionServiceImpl.getDataService();
      String key = dataService.nextServiceBoundName(lastKey);
      if (key != null && key.startsWith(nodePrefix)) {
    TaskService taskService =
        ClientSessionServiceImpl.getTaskService();
    taskService.scheduleTask(
        new CleanupDisconnectedSessionTask(key));
    lastKey = key;
    taskService.scheduleTask(this);
      }
  }
View Full Code Here

  implements RecoveryListener
    {
  /** {@inheritDoc} */
  public void recover(final Node node, RecoveryCompleteFuture future) {
      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);
              
    future.done();
View Full Code Here

  implements RecoveryListener
    {
  /** {@inheritDoc} */
  public void recover(Node node, RecoveryCompleteFuture future) {
      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() {
          /*
           * Reassign each failed coordinator to a new node.
           */
          taskService.scheduleTask(
        new ChannelImpl.ReassignCoordinatorsTask(
            nodeId));
          /*
           * Remove binding to channel server proxy for
           * failed node, and remove proxy's wrapper.
           */
          taskService.scheduleTask(
        new RemoveChannelServerProxyTask(nodeId));
      }
        },
        taskOwner);
   
View Full Code Here

  /** {@inheritDoc} */
  public void nodeFailed(Node node) {
      final long nodeId = node.getId();
      channelServerCache.remove(nodeId);
      final TaskService taskService = getTaskService();
      try {
    if (logger.isLoggable(Level.INFO)) {
        logger.log(Level.INFO,
             "Node:{0} handling nodeFailed:{1}",
             localNodeId, nodeId);
    }

    /*
     * Schedule persistent task to remove the failed sessions of
     * locally coordinated channels.
     */
    transactionScheduler.runTask(
        new AbstractKernelRunnable(
      "ScheduleRemoveFailedSessionsFromLocalChannelsTask")
        {
      public void run() {
          taskService.scheduleTask(
        new ChannelImpl.
            RemoveFailedSessionsFromLocalChannelsTask(
          localNodeId, nodeId));
      }
        }, taskOwner);
View Full Code Here

      DataService dataService =
    ClientSessionServiceImpl.getInstance().getDataService();
      // TBD: this could use a BindingKeyedMap.
      String key = dataService.nextServiceBoundName(lastKey);
      if (key != null && key.startsWith(nodePrefix)) {
    TaskService taskService =
        ClientSessionServiceImpl.getTaskService();
    taskService.scheduleTask(
        new CleanupDisconnectedSessionTask(key));
    lastKey = key;
    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

  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

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.