Package com.sun.sgs.app

Examples of com.sun.sgs.app.ClientSession


  long startTime = System.currentTimeMillis();
  for (int i = 0; i < numIterations; i++) {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        DataManager dataManager = AppContext.getDataManager();
        ClientSession session = (ClientSession)
      dataManager.getBinding(user);
        session.send(msg);
    }}, taskOwner);
  }
  long endTime = System.currentTimeMillis();
  System.err.println("send, iterations: " + numIterations +
         ", elapsed time: " + (endTime - startTime) +
View Full Code Here


            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();
      session.send(buf, Delivery.RELIABLE);
        } }, taskOwner);
  }
    }
View Full Code Here

    throw new ResourceUnavailableException("sessionRef is null");
      } else {
    System.err.println(
        "ValidatingChannelListener.validateSession: session = " +
        session);
    ClientSession thisSession = sessionRef.get();
    if (! (thisSession instanceof ClientSessionWrapper)) {
        fail("unwrapped session: " + thisSession);
    } else if (! thisSession.equals(session)) {
        fail("sessions not equal: thisSession: " +
       thisSession + ", session: " + session);
    }
      }
  }
View Full Code Here

  DummyClient client = createDummyClient(name);
  try {
      assertTrue(client.connect(serverNode.getAppPort()).login());
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
        public void run() {
      ClientSession session = (ClientSession)
          dataService.getBinding(name);
      if (!(session instanceof ClientSessionWrapper)) {
          fail("session not instance of " +
         "ClientSessionWrapper");
      }
View Full Code Here

            counter = (Counter)
          dataManager.getBinding(counterName);
        } catch (NameNotBoundException e) {
            throw new MaybeRetryException("retry", true);
        }
        ClientSession session = (ClientSession)
            dataManager.getBinding(client.name);
        MessageBuffer buf = new MessageBuffer(4);
        buf.putInt(counter.getAndIncrement());
        session.send(ByteBuffer.wrap(buf.getBuffer()),
               delivery);
          }},
     
      identity);
    }
View Full Code Here

      assertTrue(client.login());
      final int numMessages = 3;
      for (int i = 0; i < numMessages; i++) {
    txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
          ClientSession session = (ClientSession)
        AppContext.getDataManager().getBinding(name);
          System.err.println("Sending messages");
          session.send(buf, delivery);
      } }, taskOwner);
      }
 
      System.err.println("waiting for client to receive messages");
      client.waitForClientToReceiveExpectedMessages(numMessages);
View Full Code Here

    new TestAbstractKernelRunnable() {
        int tryCount = 0;
        public void run() {
      Set<ClientSession> sessions =
          getAppListener().getSessions();
      ClientSession session = sessions.iterator().next();
      try {
          session.send(ByteBuffer.wrap(new byte[4096]));
      } catch (MessageRejectedException e) {
          fail("Should not run out of buffer space: " + e);
      }
      if (++tryCount < 100) {
          throw new MaybeRetryException("Retryable"true);
View Full Code Here

  long startTime = System.currentTimeMillis();
  for (int i = 0; i < numIterations; i++) {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        DataManager dataManager = AppContext.getDataManager();
        ClientSession session = (ClientSession)
      dataManager.getBinding(user);
        session.send(msg);
    }}, taskOwner);
  }
  long endTime = System.currentTimeMillis();
  System.err.println("send, iterations: " + numIterations +
         ", elapsed time: " + (endTime - startTime) +
View Full Code Here

            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();
      session.send(buf, Delivery.RELIABLE);
        } }, taskOwner);
  }
    }
View Full Code Here

    throw new ResourceUnavailableException("sessionRef is null");
      } else {
    System.err.println(
        "ValidatingChannelListener.validateSession: session = " +
        session);
    ClientSession thisSession = sessionRef.get();
    if (! (thisSession instanceof ClientSessionWrapper)) {
        fail("unwrapped session: " + thisSession);
    } else if (! thisSession.equals(session)) {
        fail("sessions not equal: thisSession: " +
       thisSession + ", session: " + session);
    }
      }
  }
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.ClientSession

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.