Package com.sun.sgs.kernel

Examples of com.sun.sgs.kernel.TransactionScheduler


     * get them from two different test nodes.  This ensures that
     * our context is correct.
     */
    public void testContext() throws Exception {
        addNodes(null, 1);
        TransactionScheduler ts1 =
            serverNode.
                getSystemRegistry().getComponent(TransactionScheduler.class);
        TransactionScheduler ts2 =
            additionalNodes[0].
                getSystemRegistry().getComponent(TransactionScheduler.class);
       
        GetManagerTask task = new GetManagerTask();
        ts1.runTask(task, new DummyIdentity("first"));
        Object o1 = task.getManager();
        ts2.runTask(task, new DummyIdentity("second"));
        Object o2 = task.getManager();
        assertNotSame("expected different managers!", o1, o2);
       
        // Now reset to the first manager
        ts1.runTask(task, new DummyIdentity("first"));
View Full Code Here


        }
    }}, taskOwner);

      for (int i = 0; i < iterations; i++) {
    for (SgsTestNode node : nodes) {
        TransactionScheduler localTxnScheduler =
      node.getSystemRegistry().
          getComponent(TransactionScheduler.class);
        Identity identity = node.getProxy().getCurrentOwner();
        localTxnScheduler.scheduleTask(
            new TestAbstractKernelRunnable() {
          public void run() {
        DataManager dataManager =
            AppContext.getDataManager();
        Counter counter;
View Full Code Here

  SgsTestNode node, final DummyClient client, final int numMessages,
  final int offset)
  throws Exception
    {
  System.err.println("sending messages to client [" + client.name + "]");
        TransactionScheduler transactionScheduler =
            node.getSystemRegistry(). getComponent(TransactionScheduler.class);
  for (int i = 0; i < numMessages; i++) {
      final int x = i + offset;
      transactionScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        ClientSession session = (ClientSession)
      AppContext.getDataManager().getBinding(client.name);
      ByteBuffer buf = ByteBuffer.allocate(4);
      buf.putInt(x).flip();
View Full Code Here

        }
    }}, taskOwner);

      for (int i = 0; i < iterations; i++) {
    for (SgsTestNode node : nodes) {
        TransactionScheduler localTxnScheduler =
      node.getSystemRegistry().
          getComponent(TransactionScheduler.class);
        Identity identity = node.getProxy().getCurrentOwner();
        localTxnScheduler.scheduleTask(
            new TestAbstractKernelRunnable() {
          public void run() {
        DataManager dataManager =
            AppContext.getDataManager();
        Counter counter;
View Full Code Here

  SgsTestNode node, final DummyClient client, final int numMessages,
  final int offset)
  throws Exception
    {
  System.err.println("sending messages to client [" + client.name + "]");
        TransactionScheduler transactionScheduler =
            node.getSystemRegistry(). getComponent(TransactionScheduler.class);
  for (int i = 0; i < numMessages; i++) {
      final int x = i + offset;
      transactionScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        ClientSession session = (ClientSession)
      AppContext.getDataManager().getBinding(client.name);
      ByteBuffer buf = ByteBuffer.allocate(4);
      buf.putInt(x).flip();
View Full Code Here

            server.getWatchdogService().reportFailure(node.getNodeId(),
                    WatchdogService.class.getName());

            // The server node that reported the remote
            // failure should be unaffected
            TransactionScheduler sched = server.getSystemRegistry().
                    getComponent(TransactionScheduler.class);
            Identity own = server.getProxy().getCurrentOwner();
            sched.runTask(new TestAbstractKernelRunnable() {
                public void run() throws Exception {
                    assertTrue(server.getWatchdogService().isLocalNodeAlive());
                }
            }, own);

            try {
                // The node should have failed
                sched = node.getSystemRegistry().
                        getComponent(TransactionScheduler.class);
                own = node.getProxy().getCurrentOwner();
                sched.runTask(new TestAbstractKernelRunnable() {
                    public void run() throws Exception {
                        if (node.getWatchdogService().isLocalNodeAlive()) {
                            fail("Expected watchdogService.isLocalNodeAlive() " +
                                    "to return false");
                        }
View Full Code Here

TOP

Related Classes of com.sun.sgs.kernel.TransactionScheduler

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.