Package com.sun.sgs.kernel

Examples of com.sun.sgs.kernel.TransactionScheduler


  properties.setProperty(ACCESS_COORDINATOR_PROPERTY,
             MyAccessCoordinator.class.getName());
  SgsTestNode node = new SgsTestNode(
      "TestKernelSetAccessCoordinator", null, properties);
        Identity taskOwner = node.getProxy().getCurrentOwner();
        TransactionScheduler txnScheduler =
      node.getSystemRegistry().getComponent(TransactionScheduler.class);
  final DataService dataService = node.getDataService();
  txnScheduler.runTask(
      new TestAbstractKernelRunnable() {
    public void run() throws Exception {
        dataService.setBinding("a", new DummyManagedObject());
    }
      }, taskOwner);
View Full Code Here


        String.valueOf(detectMods));
  props.setProperty(DataStoreImplClass + ".flush.to.disk",
        String.valueOf(flush));
  serverNode = new SgsTestNode("TestDataServicePerformance", null, props);
  final DataService service = serverNode.getDataService();
        TransactionScheduler txnScheduler = serverNode.getSystemRegistry().
            getComponent(TransactionScheduler.class);
        Identity taskOwner = serverNode.getProxy().getCurrentOwner();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() {
                    service.setBinding("counters", new Counters(items));
                }}, taskOwner);
        for (int r = 0; r < repeat; r++) {
            long start = System.currentTimeMillis();
            for (int c = 0; c < count; c++) {
                txnScheduler.runTask(new TestAbstractKernelRunnable() {
                        public void run() throws Exception {
                            Counters counters =
                                (Counters) service.getBinding("counters");
                            for (int i = 0; i < items; i++) {
                                Counter counter = counters.get(i);
View Full Code Here

  props.setProperty(DataServiceImplClass + ".detect.modifications",
        String.valueOf(detectMods));
  props.setProperty("com.sun.sgs.txn.timeout", "10000");
  serverNode = new SgsTestNode("TestDataServicePerformance", null, props);
  final DataService service = serverNode.getDataService();
        TransactionScheduler txnScheduler = serverNode.getSystemRegistry().
            getComponent(TransactionScheduler.class);
        Identity taskOwner = serverNode.getProxy().getCurrentOwner();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() {
                    service.setBinding("counters", new Counters(items));
                }}, taskOwner);
        for (int r = 0; r < repeat; r++) {
            long start = System.currentTimeMillis();
            for (int c = 0; c < count; c++) {
                txnScheduler.runTask(new TestAbstractKernelRunnable() {
                        public void run() throws Exception {
                            Counters counters =
                                (Counters) service.getBinding("counters");
                            for (int i = 0; i < items; i++) {
                                counters.get(i);
View Full Code Here

    public void testReadForUpdate() throws Exception {
  Properties props = getNodeProps();
  props.setProperty("com.sun.sgs.txn.timeout", "10000");
  serverNode = new SgsTestNode("TestDataServicePerformance", null, props);
  final DataService service = serverNode.getDataService();
        TransactionScheduler txnScheduler = serverNode.getSystemRegistry().
            getComponent(TransactionScheduler.class);
        Identity taskOwner = serverNode.getProxy().getCurrentOwner();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() {
                    service.setBinding("counters", new Counters(items));
                }}, taskOwner);
        for (int r = 0; r < repeat; r++) {
            long start = System.currentTimeMillis();
            for (int c = 0; c < count; c++) {
                txnScheduler.runTask(new TestAbstractKernelRunnable() {
                        public void run() throws Exception {
                            Counters counters =
                                (Counters) service.getBinding("counters");
                            for (int i = 0; i < items; i++) {
                                counters.getForUpdate(i);
View Full Code Here

    public void testMarkForUpdate() throws Exception {
  Properties props = getNodeProps();
  props.setProperty("com.sun.sgs.txn.timeout", "10000");
  serverNode = new SgsTestNode("TestDataServicePerformance", null, props);
  final DataService service = serverNode.getDataService();
        TransactionScheduler txnScheduler = serverNode.getSystemRegistry().
            getComponent(TransactionScheduler.class);
        Identity taskOwner = serverNode.getProxy().getCurrentOwner();
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
                public void run() {
                    service.setBinding("counters", new Counters(items));
                }}, taskOwner);
        for (int r = 0; r < repeat; r++) {
            long start = System.currentTimeMillis();
            for (int c = 0; c < count; c++) {
                txnScheduler.runTask(new TestAbstractKernelRunnable() {
                        public void run() throws Exception {
                            Counters counters =
                                (Counters) service.getBinding("counters");
          DataManager dataManager =
        AppContext.getDataManager();
View Full Code Here

  throws Exception
    {
  if (node == null) {
      node = serverNode;
  }
  TransactionScheduler nodeTxnScheduler =
      node.getSystemRegistry().getComponent(TransactionScheduler.class);
  Identity nodeTaskOwner =
      node.getProxy().getCurrentOwner();
  nodeTxnScheduler.runTask(task, nodeTaskOwner);
    }
View Full Code Here

        public TestService(Properties properties,
                    ComponentRegistry systemRegistry,
                    TransactionProxy txnProxy)
            throws Exception
        {
            TransactionScheduler transactionScheduler =
                systemRegistry.getComponent(TransactionScheduler.class);

            transactionScheduler.runTask(
    new AbstractKernelRunnable("UseStartupContext") {
        public void run() {
                        DataManager data = AppContext.getDataManager();
                        System.out.println("Data manager is " + data);
        } },  txnProxy.getCurrentOwner());
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.