Package org.eclipse.ecf.datashare

Examples of org.eclipse.ecf.datashare.IChannel


      pendingSockets.clear();
    }

    synchronized (channels) {
      for (Iterator it = channels.values().iterator(); it.hasNext();) {
        final IChannel channel = (IChannel) it.next();
        // dispose the channel in a SafeRunner so exceptions don't
        // prevent us from disposing other channels
        SafeRunner.run(new ISafeRunnable() {
          public void run() throws Exception {
            channel.dispose();
          }

          public void handleException(Throwable t) {
            log(new Status(IStatus.ERROR, Util.PLUGIN_ID,
                "Error disposing channel: " + channel, t)); //$NON-NLS-1$
View Full Code Here


    // first response should be the channel id
    ID channelId = (ID) ois.readObject();

    synchronized (channels) {
      // retrieve the channel that corresponds to that id
      IChannel channel = getChannel(channelId);
      if (channel == null) {
        // can't find a channel that corresponds to the id, close the
        // socket
        Util.closeChannel(socketChannel);
      } else {
View Full Code Here

      IChannelConfig newChannelConfig) throws ECFException;

  public final IChannel createChannel(ID channelId,
      IChannelListener listener, Map properties) throws ECFException {
    Assert.isNotNull(channelId, "Channel id cannot be null"); //$NON-NLS-1$
    IChannel channel = createNIOChannel(channelId, listener, properties);
    if (channel != null) {
      storeChannel(channel);

      fireChannelContainerActivatedEvent(channelId);
    }
View Full Code Here

      throws ECFException {
    Assert.isNotNull(newChannelConfig, "Channel config cannot be null"); //$NON-NLS-1$
    Assert.isNotNull(newChannelConfig.getID(),
        "Channel config id cannot be null"); //$NON-NLS-1$

    IChannel channel = createNIOChannel(newChannelConfig);
    if (channel != null) {
      storeChannel(channel);

      fireChannelContainerActivatedEvent(newChannelConfig.getID());
    }
View Full Code Here

    Assert.isNotNull(channelId, "Channel id cannot be null"); //$NON-NLS-1$
    return (IChannel) channels.get(channelId);
  }

  public boolean removeChannel(ID channelId) {
    IChannel channel = (IChannel) channels.remove(channelId);
    if (channel == null) {
      return false;
    } else {
      channel.dispose();
      return true;
    }
  }
View Full Code Here

          scribbleView.handleDrawLine(msg.getData());
        }
      }
    };
    // Create new channel
    IChannel channel = channelContainer.createChannel(channelID,
        channelListener, new HashMap());
    // Set the view to use the given channel (for sending)
    scribbleView.setChannel(channel);
  }
View Full Code Here

    cleanUpClients();
    super.tearDown();
  }

  public void testSendMessage() throws Exception {
    final IChannel ch0 = getChannelContainer(0).getChannel(channelID);
    ID target1 = getClient(1).getConnectedID();
    ch0.sendMessage(target1, new String("hello").getBytes());
    sleep(SLEEPTIME);
  }
View Full Code Here

    ch0.sendMessage(target1, new String("hello").getBytes());
    sleep(SLEEPTIME);
  }

  public void testBiSendMessage() throws Exception {
    final IChannel ch0 = getChannelContainer(0).getChannel(channelID);
    final IChannel ch1 = getChannelContainer(1).getChannel(channelID);
   
    ID target1 = getClient(1).getConnectedID();
    ID target0 = getClient(0).getConnectedID();
   
    ch0.sendMessage(target1, new String("hello").getBytes());
    ch1.sendMessage(target0, new String("hello").getBytes());
    sleep(SLEEPTIME);
  }
View Full Code Here

    sleep(SLEEPTIME);
  }


  public void testSendMessages() throws Exception {
    final IChannel ch0 = getChannelContainer(0).getChannel(channelID);
    ID target1 = getClient(1).getConnectedID();
    for(int i=0; i < SEND_MESSAGE_COUNT; i++) {
      ch0.sendMessage(target1, new String("hello.  msg#="+i).getBytes());
    }
    sleep(SLEEPTIME);
  }
View Full Code Here

    }
    sleep(SLEEPTIME);
  }

  public void testBiSendMessages() throws Exception {
    final IChannel ch0 = getChannelContainer(0).getChannel(channelID);
    final IChannel ch1 = getChannelContainer(1).getChannel(channelID);
   
    ID target1 = getClient(1).getConnectedID();
    ID target0 = getClient(0).getConnectedID();
       
    for(int i=0; i < SEND_MESSAGE_COUNT; i++) {
      ch0.sendMessage(target1, new String("hello.  msg#="+i).getBytes());
      ch1.sendMessage(target0, new String("hello.  msg#="+i).getBytes());
    }
    sleep(SLEEPTIME);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.datashare.IChannel

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.