Package com.sun.sgs.service

Examples of com.sun.sgs.service.Node


        ClientSessionHandler handler)
  {
      ClientSessionImpl sessionImpl = eventQueue.getClientSession();
      sessionImpl.setRelocatingToNode(newNodeId);

      Node newNode = sessionService.watchdogService.getNode(newNodeId);
      if (newNode == null) {
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE,
             "Session:{0} unable to relocate from node:{1} " +
             "to FAILED node:{2}", this,
View Full Code Here


        return getClass().getName();
    }

    /** {@inheritDoc} */
    public void ready() {
        Node node = nodeMap.get(localId);
        for (NodeListener listener : listeners)
            listener.nodeHealthUpdate(node);
    }
View Full Code Here

    /** {@inheritDoc} */
    public void shutdown() {
        health = Health.RED;
        nodeMap.remove(localId);
        Node localNode = new NodeImpl(localId);
        for (NodeListener listener : listeners)
            listener.nodeHealthUpdate(localNode);
    }
View Full Code Here

        return nodeMap.values().iterator();
    }

    /** {@inheritDoc} */
    public Node getNode(long nodeId) {
        Node node = nodeMap.get(nodeId);
        if (node == null)
            throw new IllegalArgumentException("Unknown node id: " + nodeId);
        return node;
    }
View Full Code Here

      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;
    }
      }
  }
  return getLocalNodeId();
View Full Code Here

        }
       
        serviceStats.getNodeOp.report();

        Context context = contextFactory.joinTransaction();
        Node node = context.get(id);
        logger.log(Level.FINEST, "getNode id:{0} returns {1}", id, node);
        return node;
    }
View Full Code Here

    {
        checkState();
        serviceStats.getIdentitiesOp.report();

        // Verify that the nodeId is valid.
        Node node = watchdogService.getNode(nodeId);
        if (node == null) {
            throw new UnknownNodeException("node id: " + nodeId);
        }
        IdentityIterator iter = new IdentityIterator(dataService, nodeId);
        logger.log(Level.FINEST, "getIdentities successful");
View Full Code Here

        }
       
        public Node get(Identity identity) throws UnknownIdentityException {
            assert identity != null;
            // Check the cache
            Node node = idcache.get(identity);
            if (node != null) {
                return node;
            }
           
      String key = NodeMapUtil.getIdentityKey(identity);
      try {               
    IdentityMO idmo =
        (IdentityMO) dataService.getServiceBinding(key);
                node = watchdogService.getNode(idmo.getNodeId());
                if (node == null) {
                    // The identity is on a failed node, where the node has
                    // been removed from the data store but the identity hasn't
                    // yet.
                    throw new UnknownIdentityException("id: " + identity);
                }
                Node old = idcache.put(identity, node);
                assert (old == null);
                return node;
      } catch (NameNotBoundException e) {
                throw new UnknownIdentityException("id: " + identity);
      } catch (ObjectNotFoundException e1) {
View Full Code Here

     * 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

      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;
    }
      }
  }
  return getLocalNodeId();
View Full Code Here

TOP

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

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.