Package com.sun.sgs.app

Examples of com.sun.sgs.app.Channel


    }

    protected void leaveAll(final String channelName) throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    Channel channel = getChannel(channelName);
    channel.leaveAll();
      }
  }, taskOwner);
    }
View Full Code Here


  final String channelName, final String... users)
  throws Exception
    {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    Channel channel = getChannel(channelName);
    Set<ClientSession> sessions = getSessions(channel);
    System.err.println("Sessions joined:" + sessions);
    if (sessions.size() != users.length) {
        fail("Expected " + users.length + " sessions, got " +
       sessions.size());
View Full Code Here

             HexDumper.format(buf.getBuffer()));
     
      txnScheduler.runTask(
    new TestAbstractKernelRunnable() {
        public void run() {
      Channel channel = getChannel(channelName);
      channel.send(null, ByteBuffer.wrap(buf.getBuffer()));
        }
    }, taskOwner);
  }
    }
View Full Code Here

  throws Exception
    {
  return KernelCallable.call(
      new KernelCallable<BigInteger>("getChannelId") {
    public BigInteger call() throws Exception {
    Channel channel =
        AppContext.getChannelManager().getChannel(channelName);
    Field field = getField(channel.getClass(), "channelRef");
    ManagedReference channelRef =
        (ManagedReference) field.get(channel);
    return channelRef.getId();
    }
      }, txnScheduler, taskOwner);
View Full Code Here

         ChannelListener listener,
         Delivery delivery)
    {
        serviceStats.createChannelOp.report();
  try {
      Channel channel = ChannelImpl.newInstance(
    name, listener, delivery, writeBufferSize);
      return channel;
     
  } catch (RuntimeException e) {
      logger.logThrow(Level.FINEST, e, "createChannel:{0} throws");
View Full Code Here

  void checkMembership(final String name, final boolean isMember)
      throws Exception
  {
      txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
        Channel channel = getChannel(name);
        Set<ClientSession> sessions = getSessions(channel);
        for (DummyClient client : clients.values()) {

      ClientSession session = getClientSession(client.name);
View Full Code Here

    @Test
    public void testChannelWriteReadObject() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() throws Exception {
    Channel savedChannel =
        channelService.createChannel("x", null, Delivery.RELIABLE);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(bout);
    out.writeObject(savedChannel);
    out.flush();
    out.close();
   
    ByteArrayInputStream bin =
        new ByteArrayInputStream(bout.toByteArray());
    ObjectInputStream in = new ObjectInputStream(bin);
    Channel channel = (Channel) in.readObject();

    if (!savedChannel.equals(channel)) {
        fail("Expected channel: " + savedChannel +
       ", got " + channel);
    }
View Full Code Here

   
    // -- Test Channel.getName --

    @Test
    public void testChannelGetNameNoTxn() throws Exception {
  Channel channel = createChannel();
  try {
      channel.getName();
      fail("Expected TransactionNotActiveException");
  } catch (TransactionNotActiveException e) {
      System.err.println(e);
  }
    }
View Full Code Here

  }
    }

    @Test
    public void testChannelGetNameMismatchedTxn() throws Exception {
  final Channel channel = createChannel();
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    try {
        channel.getName();
        fail("Expected TransactionNotActiveException");
    } catch (TransactionNotActiveException e) {
        System.err.println(e);
    }
      }
View Full Code Here

    @Test
    public void testChannelGetName() throws Exception {
  txnScheduler.runTask(new TestAbstractKernelRunnable() {
      public void run() {
    String name = "foo";
    Channel channel = channelService.createChannel(
        name, null, Delivery.RELIABLE);
    if (!name.equals(channel.getName())) {
        fail("Expected: " + name + ", got: " + channel.getName());
    }
      }
  }, taskOwner);
    }
View Full Code Here

TOP

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

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.