Example #1
0
 @Override
 public synchronized Map<String, Object> getProperties() {
   Map<String, Object> properties = new HashMap<String, Object>();
   if (channel != null) {
     properties.put("Channel name", channel.getChannelName());
     properties.put("Connection state", channel.getConnectionState().name());
     properties.put("Provider name", channel.getProvider().getProviderName());
     if (channel.getConnectionState() == Channel.ConnectionState.CONNECTED) {
       properties.put("Remote address", channel.getRemoteAddress());
       properties.put("Channel type", channelType.getID());
       // properties.put("Read access", channel.getReadAccess());
       // properties.put("Write access", channel.getWriteAccess());
     }
   }
   return properties;
 }
Example #2
0
  @Override
  public void addReader(ChannelHandlerReadSubscription subscription) {
    super.addReader(subscription);

    if (!monitorCreated.getAndSet(true)) {
      // TODO remove this....
      for (int i = 0;
          i < 100 && channel.getConnectionState() == ConnectionState.NEVER_CONNECTED;
          i++) {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
        }
      }
      // TODO optimize fields
      channel.createMonitor(this, CreateRequestFactory.createRequest("field()", this));
    }
  }