Search in sources :

Example 1 with ChannelInformation

use of io.joynr.messaging.info.ChannelInformation in project joynr by bmwcarit.

the class LongPollingMessagingDelegate method listChannels.

/**
 * Gets a list of all channel information.
 *
 * @return list of all channel informations
 */
public List<ChannelInformation> listChannels() {
    LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>();
    Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll();
    String name;
    for (Broadcaster broadcaster : broadcasters) {
        if (broadcaster instanceof BounceProxyBroadcaster) {
            name = ((BounceProxyBroadcaster) broadcaster).getName();
        } else {
            name = broadcaster.getClass().getSimpleName();
        }
        Integer cachedSize = null;
        entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize));
    }
    return entries;
}
Also used : ChannelInformation(io.joynr.messaging.info.ChannelInformation) Broadcaster(org.atmosphere.cpr.Broadcaster) LinkedList(java.util.LinkedList)

Example 2 with ChannelInformation

use of io.joynr.messaging.info.ChannelInformation in project joynr by bmwcarit.

the class ChannelServiceImpl method listChannels.

/*
     * (non-Javadoc)
     * 
     * @see io.joynr.messaging.service.ChannelServiceDelegate#listChannels()
     */
@Override
public List<ChannelInformation> listChannels() {
    List<Channel> channels = channelDirectory.getChannels();
    List<ChannelInformation> channelInformationList = new LinkedList<ChannelInformation>();
    for (Channel channel : channels) {
        ChannelInformation channelInfo = new ChannelInformation(channel.getChannelId(), 0, 0);
        channelInformationList.add(channelInfo);
    }
    return channelInformationList;
}
Also used : ChannelInformation(io.joynr.messaging.info.ChannelInformation) Channel(io.joynr.messaging.info.Channel) LinkedList(java.util.LinkedList)

Aggregations

ChannelInformation (io.joynr.messaging.info.ChannelInformation)2 LinkedList (java.util.LinkedList)2 Channel (io.joynr.messaging.info.Channel)1 Broadcaster (org.atmosphere.cpr.Broadcaster)1