@Test public void getLatestFromAllChannelsTest() { List<String> list = channelBufferManager.getLatestFromAllChannels(2); assertNotNull(list); String actualString = list.get(0); boolean isActualString = false; if(actualString != null) isActualString = true; assertEquals(true, isActualString); }
public List<String> getLatestFromAllChannels(final int msgCount) { List<String>dataSet = new ArrayList<String>(); final int EXTRA = 3; try { if (subscribedChannels != null && !subscribedChannels.keySet().isEmpty()) { for (String channelName: subscribedChannels.keySet()) { ChannelBuffer cb = subscribedChannels.get(channelName); if (cb.getPubliclyListed()) { List<String> fetchedList = cb.getMessages(msgCount+EXTRA); if (fetchedList != null) { dataSet.addAll(fetchedList); } } } } } catch (Exception e) { logger.error("Unable to get list of latest messages across channels"); } return (dataSet.isEmpty() ? null : dataSet); }
ChannelBufferManager { public List<String> getLatestFromAllChannels(final int msgCount) { List<String>dataSet = new ArrayList<String>(); final int EXTRA = 3; try { if (subscribedChannels != null && !subscribedChannels.keySet().isEmpty()) { for (String channelName: subscribedChannels.keySet()) { ChannelBuffer cb = subscribedChannels.get(channelName); if (cb.getPubliclyListed()) { List<String> fetchedList = cb.getMessages(msgCount+EXTRA); if (fetchedList != null) { dataSet.addAll(fetchedList); } } } } } catch (Exception e) { logger.error("Unable to get list of latest messages across channels"); } return (dataSet.isEmpty() ? null : dataSet); } }
ChannelBufferManager { public List<String> getLatestFromAllChannels(final int msgCount) { List<String>dataSet = new ArrayList<String>(); final int EXTRA = 3; try { if (subscribedChannels != null && !subscribedChannels.keySet().isEmpty()) { for (String channelName: subscribedChannels.keySet()) { ChannelBuffer cb = subscribedChannels.get(channelName); if (cb.getPubliclyListed()) { List<String> fetchedList = cb.getMessages(msgCount+EXTRA); if (fetchedList != null) { dataSet.addAll(fetchedList); } } } } } catch (Exception e) { logger.error("Unable to get list of latest messages across channels"); } return (dataSet.isEmpty() ? null : dataSet); } ChannelBufferManager(); }
ChannelBufferManager { public List<String> getLatestFromAllChannels(final int msgCount) { List<String>dataSet = new ArrayList<String>(); final int EXTRA = 3; try { if (subscribedChannels != null && !subscribedChannels.keySet().isEmpty()) { for (String channelName: subscribedChannels.keySet()) { ChannelBuffer cb = subscribedChannels.get(channelName); if (cb.getPubliclyListed()) { List<String> fetchedList = cb.getMessages(msgCount+EXTRA); if (fetchedList != null) { dataSet.addAll(fetchedList); } } } } } catch (Exception e) { logger.error("Unable to get list of latest messages across channels"); } return (dataSet.isEmpty() ? null : dataSet); } ChannelBufferManager(); void initiateChannelBufferManager(final String channelRegEx); ExecutorService getExecutorServicePool(); void initiateChannelBufferManager(final int bufferSize, final String channelRegEx); void manageChannelBuffersWrapper(final String subscriptionPattern, final String channelName, 
			final String receivedMessage); void manageChannelBuffers(final String subscriptionPattern, final String channelName, 
			final String receivedMessage); void addMessageToChannelBuffer(final String channelName, final String msg); List<String> getLastMessages(String channelName, int msgCount); boolean isChannelPresent(String channelName); void createChannelQueue(final String channelName); void deleteChannelBuffer(final String channelName); void deleteAllChannelBuffers(); Set<String> getActiveChannelsList(); Set<String> getActiveChannelCodes(); @SuppressWarnings("unchecked") Boolean getChannelPublicStatus(String channelName); @SuppressWarnings("unchecked") Map<String, Boolean> getAllRunningCollections(); List<String> getLatestFromAllChannels(final int msgCount); String parseChannelName(String channelName); void close(); }
ChannelBufferManager { public List<String> getLatestFromAllChannels(final int msgCount) { List<String>dataSet = new ArrayList<String>(); final int EXTRA = 3; try { if (subscribedChannels != null && !subscribedChannels.keySet().isEmpty()) { for (String channelName: subscribedChannels.keySet()) { ChannelBuffer cb = subscribedChannels.get(channelName); if (cb.getPubliclyListed()) { List<String> fetchedList = cb.getMessages(msgCount+EXTRA); if (fetchedList != null) { dataSet.addAll(fetchedList); } } } } } catch (Exception e) { logger.error("Unable to get list of latest messages across channels"); } return (dataSet.isEmpty() ? null : dataSet); } ChannelBufferManager(); void initiateChannelBufferManager(final String channelRegEx); ExecutorService getExecutorServicePool(); void initiateChannelBufferManager(final int bufferSize, final String channelRegEx); void manageChannelBuffersWrapper(final String subscriptionPattern, final String channelName, 
			final String receivedMessage); void manageChannelBuffers(final String subscriptionPattern, final String channelName, 
			final String receivedMessage); void addMessageToChannelBuffer(final String channelName, final String msg); List<String> getLastMessages(String channelName, int msgCount); boolean isChannelPresent(String channelName); void createChannelQueue(final String channelName); void deleteChannelBuffer(final String channelName); void deleteAllChannelBuffers(); Set<String> getActiveChannelsList(); Set<String> getActiveChannelCodes(); @SuppressWarnings("unchecked") Boolean getChannelPublicStatus(String channelName); @SuppressWarnings("unchecked") Map<String, Boolean> getAllRunningCollections(); List<String> getLatestFromAllChannels(final int msgCount); String parseChannelName(String channelName); void close(); static final int NO_DATA_TIMEOUT; static final int CHECK_INTERVAL; static final int CHECK_CHANNEL_PUBLIC_INTERVAL; static String redisHost; static int redisPort; static JedisConnectionObject jedisConn; static Jedis subscriberJedis; static RedisSubscriber aidrSubscriber; static final String CHANNEL_PREFIX_STRING; static ConcurrentHashMap<String, ChannelBuffer> subscribedChannels; }