Examples of WatchdogService


Examples of com.sun.sgs.service.WatchdogService

    private long chooseCoordinatorNode() {
  if (!servers.isEmpty()) {
      int numServers = servers.size();
      Long[] serverIds = servers.toArray(new Long[numServers]);
      int startIndex = random.nextInt(numServers);
      WatchdogService watchdogService =
    ChannelServiceImpl.getWatchdogService();
      for (int i = 0; i < numServers; i++) {
    int tryIndex = (startIndex + i) % numServers;
    long candidateId = serverIds[tryIndex];
    Node coordCandidate = watchdogService.getNode(candidateId);
    if (coordCandidate != null && coordCandidate.isAlive()) {
        return candidateId;
    }
      }
  }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

  public void run() {
      if (!channelIter.hasNext()) {
    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);
        }
    }
      }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

      this.nodeId = nodeId;
  }

  /** {@inheritDoc} */
  public void run() {
      WatchdogService watchdogService =
    txnProxy.getService(WatchdogService.class);
      Node node = watchdogService.getNode(nodeId);
      isAlive = node != null && node.isAlive();
  }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

                        VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
            } }, taskOwner);
               
        // get the current node id for the hand-off namespace, and register
        // for recovery notices to manage cleanup of hand-off bindings
        WatchdogService watchdogService =
                txnProxy.getService(WatchdogService.class);
        nodeId = watchdogService.getLocalNodeId();
        localHandoffSpace = DS_HANDOFF_SPACE + nodeId;
        watchdogService.addRecoveryListener(this);

        // get the start delay and the length of time between hand-off checks
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        handoffStart = wrappedProps.getLongProperty(HANDOFF_START_PROPERTY,
                                                    HANDOFF_START_DEFAULT);
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

        channelServerMap =
      collectionsFactory.newMap(CHANNEL_SERVER_MAP_PREFIX);
    }
      }
      contextFactory = new ContextFactory(contextMap);
      WatchdogService watchdogService =
    txnProxy.getService(WatchdogService.class);
      sessionService = txnProxy.getService(ClientSessionService.class);
      localNodeId = watchdogService.getLocalNodeId();

            writeBufferSize = wrappedProps.getIntProperty(
                WRITE_BUFFER_SIZE_PROPERTY, DEFAULT_WRITE_BUFFER_SIZE,
                8192, Integer.MAX_VALUE);
      /*
       * Get the property for controlling channel event processing.
       */
      eventsPerTxn = wrappedProps.getIntProperty(
    EVENTS_PER_TXN_PROPERTY, DEFAULT_EVENTS_PER_TXN,
    1, Integer.MAX_VALUE);
     
      /*
       * Export the ChannelServer.
       */
      int serverPort = wrappedProps.getIntProperty(
    SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
      serverImpl = new ChannelServerImpl();
      exporter = new Exporter<ChannelServer>(ChannelServer.class);
      try {
    int port = exporter.export(serverImpl, serverPort);
    serverProxy = exporter.getProxy();
    logger.log(
        Level.CONFIG,
        "ChannelServer export successful. port:{0,number,#}", port);
      } catch (Exception e) {
    try {
        exporter.unexport();
    } catch (RuntimeException re) {
    }
    throw e;
      }

      /*
       * Check service version.
       */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("CheckServiceVersion") {
        public void run() {
      checkServiceVersion(
          VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
        } },  taskOwner);
     
      /*
       * Create channel server map, keyed by node ID.  Then store
       * channel server in the channel server map.
       */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("StoreChannelServerProxy") {
        public void run() {
      getChannelServerMap().put(
          Long.toString(localNodeId), serverProxy);
        } },
    taskOwner);

      /*
       * Add listeners for handling recovery and for receiving
       * notification of client session disconnection.
       */
      watchdogService.addRecoveryListener(
    new ChannelServiceRecoveryListener());

      watchdogService.addNodeListener(new ChannelServiceNodeListener());

            sessionService.registerSessionDisconnectListener(
                new ChannelSessionDisconnectListener());

            /* Create our service profiling info and register our MBean. */
 
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

            super(properties, systemRegistry, txnProxy, logger);
        }

        public boolean isAlive() {
            // get the watchdog service to check if the node is alive
            WatchdogService svc = txnProxy.getService(WatchdogService.class);
            return svc.isLocalNodeAlive();
        }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

            WatchdogService svc = txnProxy.getService(WatchdogService.class);
            return svc.isLocalNodeAlive();
        }

        public void reportLocalFailure() throws IOException {
            WatchdogService svc = txnProxy.getService(WatchdogService.class);
            svc.reportFailure(
    txnProxy.getService(DataService.class).getLocalNodeId(),
    this.getClass().getName());
        }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

    txnProxy.getService(DataService.class).getLocalNodeId(),
    this.getClass().getName());
        }

        public void reportRemoteFailure(long nodeId) throws IOException {
            WatchdogService svc = txnProxy.getService(WatchdogService.class);
            svc.reportFailure(nodeId, this.getClass().getName());
        }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

      this.nodeId = nodeId;
  }

  /** {@inheritDoc} */
  public void run() {
      WatchdogService watchdogService =
    txnProxy.getService(WatchdogService.class);
      Node node = watchdogService.getNode(nodeId);
      isAlive = node != null && node.isAlive();
  }
View Full Code Here

Examples of com.sun.sgs.service.WatchdogService

  public void run() {
      if (!channelIter.hasNext()) {
    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);
        }
    }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.