Package com.sun.sgs.impl.service.nodemap

Examples of com.sun.sgs.impl.service.nodemap.NodeMappingServerImpl


            Field mapServer =
                    NodeMappingServiceImpl.class.getDeclaredField("serverImpl");
            mapServer.setAccessible(true);
            final NodeMappingService nodeMappingService =
                    serverNode.getNodeMappingService();
            NodeMappingServerImpl nodeMappingServer =
                    (NodeMappingServerImpl) mapServer.get(nodeMappingService);
           
            // Create a new identity and assign it to a node
            // Since there is only 1 app node, it will be assigned to that one
            final Identity id = new IdentityImpl(appName + "_identity");
            nodeMappingService.assignNode(NodeMappingService.class, id);
            System.err.println("AppNode id: "+appNode.getNodeId());

            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    // See if the right node has the identity
                    long nodeid = nodeMappingService.getNode(id).getId();
                    System.err.println("Identity is on node: "+nodeid);
                    if (nodeid != appNode.getNodeId())
                        fail("Identity is on the wrong node");
                }
            }, taskOwner);

            // Convince the Node Mapping server that the identity
            // has been removed. This ensures that rtask.isDead() is true
            appNode.getNodeMappingService().setStatus(
                    NodeMappingService.class, id, false);

            // Unexport the NodeMappingService on the appNode to shutdown the
            // service without removing the node listener. This should
            // cause an IOException in the RemoveTask of the server when
            // removing the identity.
            Field privateField =
                    NodeMappingServiceImpl.class.getDeclaredField("exporter");
            privateField.setAccessible(true);
            Exporter<?> exporter = (Exporter<?>) privateField.get(
                    appNode.getNodeMappingService());
            exporter.unexport();
           
            Thread.sleep(renewTime); // Let it shutdown
            nodeMappingServer.canRemove(id); // Remove the identity
            Thread.sleep(renewTime); // Wait for RemoveThread to run on server
           
            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    try {
View Full Code Here


        Node firstNode = task.getNode();
        long firstNodeId = task.getNodeId();
        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);
       
        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
View Full Code Here

        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
        TestRelocationListener idListener = moveMap.get(firstNodeId);

  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);

        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
View Full Code Here

        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
        TestRelocationListener idListener = moveMap.get(firstNodeId);

  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);

        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
View Full Code Here

        TestListener firstNodeListener = nodeListenerMap.get(firstNodeId);
        TestRelocationListener idListener = moveMap.get(firstNodeId);

  firstNodeListener.waitForNotification();

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);

        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
View Full Code Here

        txnScheduler.runTask(task, taskOwner);;
        long firstNodeId = task.getNodeId();
        Node firstNode = task.getNode();
        TestRelocationListener idListener = moveMap.get(firstNodeId);

        NodeMappingServerImpl server =
            (NodeMappingServerImpl)serverImplField.get(nodeMappingService);

        // clear out the listeners
        for (TestListener lis : nodeListenerMap.values()) {
            lis.clear();
View Full Code Here

            Field mapServer =
                    NodeMappingServiceImpl.class.getDeclaredField("serverImpl");
            mapServer.setAccessible(true);
            final NodeMappingService nodeMappingService =
                    serverNode.getNodeMappingService();
            NodeMappingServerImpl nodeMappingServer =
                    (NodeMappingServerImpl) mapServer.get(nodeMappingService);
           
            // Create a new identity and assign it to a node
            // Since there is only 1 app node, it will be assigned to that one
            final Identity id = new IdentityImpl(appName + "_identity");
            nodeMappingService.assignNode(NodeMappingService.class, id);
            System.err.println("AppNode id: "+appNode.getNodeId());

            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    // See if the right node has the identity
                    long nodeid = nodeMappingService.getNode(id).getId();
                    System.err.println("Identity is on node: "+nodeid);
                    if (nodeid != appNode.getNodeId())
                        fail("Identity is on the wrong node");
                }
            }, taskOwner);

            // Convince the Node Mapping server that the identity
            // has been removed. This ensures that rtask.isDead() is true
            appNode.getNodeMappingService().setStatus(
                    NodeMappingService.class, id, false);

            // Unexport the NodeMappingService on the appNode to shutdown the
            // service without removing the node listener. This should
            // cause an IOException in the RemoveTask of the server when
            // removing the identity.
            Field privateField =
                    NodeMappingServiceImpl.class.getDeclaredField("exporter");
            privateField.setAccessible(true);
            Exporter<?> exporter = (Exporter<?>) privateField.get(
                    appNode.getNodeMappingService());
            exporter.unexport();
           
            Thread.sleep(renewTime); // Let it shutdown
            nodeMappingServer.canRemove(id); // Remove the identity
            Thread.sleep(renewTime); // Wait for RemoveThread to run on server
           
            txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    try {
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.service.nodemap.NodeMappingServerImpl

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.