Examples of ITopic


Examples of com.hazelcast.core.ITopic

    private CombinedClassLoader combinedClassLoader;

    @Override
    public EventProducer getEventProducer(String name, Boolean pubsub) {
        if (pubsub) {
                ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
                TopicProducer producer = new TopicProducer();
                producer.setInstance(instance);
                producer.setTopic(topic);
                producer.setNode(getNode());
                producer.init();
View Full Code Here

Examples of com.hazelcast.core.ITopic

    }

    @Override
    public EventConsumer getEventConsumer(String name, Boolean pubsub) {
        if (pubsub) {
                ITopic topic = instance.getTopic(Constants.TOPIC + Constants.SEPARATOR + name);
                TopicConsumer consumer = new TopicConsumer();
                consumer.setTopic(topic);
                consumer.setInstance(instance);
                consumer.setNode(getNode());
                consumer.setDispatcher(dispatcher);
View Full Code Here

Examples of com.hazelcast.core.ITopic

        CountDownLatch l1 = new CountDownLatch(1000);
        CountDownLatch l2 = new CountDownLatch(1000);
        CountDownLatch l3 = new CountDownLatch(1000);

        ITopic t1 = h1.getTopic("foo");
        ITopic t2 = h2.getTopic("foo");
        ITopic t3 = h3.getTopic("foo");

        t1.addMessageListener(createMessageListener(l1));
        t2.addMessageListener(createMessageListener(l2));
        t3.addMessageListener(createMessageListener(l3));

        MemberImpl m1 = (MemberImpl) h1.getCluster().getLocalMember();
        MemberImpl m2 = (MemberImpl) h2.getCluster().getLocalMember();
        MemberImpl m3 = (MemberImpl) h3.getCluster().getLocalMember();
View Full Code Here

Examples of com.hazelcast.core.ITopic

public class TopicTest extends HazelcastTestSupport {

    @Test
    public void testDestroyTopicRemovesStatistics() {
        HazelcastInstance instance = createHazelcastInstance();
        final ITopic topic = instance.getTopic("foo");
        topic.publish("foobar");

        //we need to give the message the chance to be processed, else the topic statistics are recreated.
        //so in theory the destroy for the topic is broken.
        sleepSeconds(1);

        topic.destroy();

        final TopicService topicService = getNode(instance).nodeEngine.getService(TopicService.SERVICE_NAME);

        assertTrueEventually(new AssertTask() {
            @Override
            public void run() {
                boolean containsStats = topicService.getStatsMap().containsKey(topic.getName());
                assertFalse(containsStats);
            }
        });
    }
View Full Code Here

Examples of com.hazelcast.core.ITopic

    @Test
    public void testPerformance() throws InterruptedException {
        HazelcastInstance hazelcastInstance = createHazelcastInstance();
        int count = 10000;
        final ITopic topic = hazelcastInstance.getTopic("perf");
        ExecutorService ex = Executors.newFixedThreadPool(10);
        final CountDownLatch l = new CountDownLatch(count);
        for (int i = 0; i < count; i++) {
            ex.submit(new Runnable() {
                public void run() {
                    topic.publish("my object");
                    l.countDown();
                }
            });
        }
        assertTrue(l.await(20, TimeUnit.SECONDS));
View Full Code Here

Examples of com.hazelcast.core.ITopic

            this.name = s;
        }
    }

    private List<Runnable> loadTopicOperations() {
        ITopic topic = hazelcast.getTopic("myTopic");
        topic.addMessageListener(new MessageListener() {
            public void onMessage(Message message) {
                messagesReceived.incrementAndGet();
            }
        });
        List<Runnable> operations = new ArrayList<Runnable>();
        addOperation(operations, new Runnable() {
            public void run() {
                ITopic topic = hazelcast.getTopic("myTopic");
                topic.publish(String.valueOf(random.nextInt(100000000)));
                messagesSend.incrementAndGet();
            }
        }, 10);
        return operations;
    }
View Full Code Here

Examples of org.eclipse.help.ITopic

      return UrlUtil.getHelpURL(topicHref);
    else
    if (selectedToc == -1)
      return null;
    IToc toc = tocs[selectedToc];
    ITopic tocDescription = toc.getTopic(null);
    if (tocDescription != null)
      return UrlUtil.getHelpURL(tocDescription.getHref());
    return UrlUtil.getHelpURL(null);
  }
View Full Code Here

Examples of org.eclipse.help.ITopic

      }
    } else {
      // try obtaining the TOC from the topic
      selectedToc = findTocContainingTopic(topicHref);

      ITopic topic = findTopic();
      if (topic != null
          && topic instanceof org.eclipse.help.internal.toc.Topic) {
        topicPath = ((org.eclipse.help.internal.toc.Topic) topic)
            .getPathInToc(tocs[selectedToc]);
      }
View Full Code Here

Examples of org.eclipse.help.ITopic

    }

    public void generateLinks(Writer out) {
        for (int i = 0; i < tocs.length; i++) {
            IToc toc = tocs[i];
            ITopic tocTopic = toc.getTopic(null);
            generateTopicLinks(tocTopic, out, 0);
            ITopic[] topics = toc.getTopics();
            for (int t = 0; t < topics.length; t++) {
                generateTopicLinks(topics[t], out, 1);
            }
View Full Code Here

Examples of org.eclipse.help.ITopic

  private void writeElements(IUAElement[] children,
      StringBuilder helpContextBuilder, StringBuilder newJavaFileBuilder,
      int tocLevel) {
    for (IUAElement child : children) {
      if (child instanceof ITopic) {
        ITopic topic = ((ITopic) child);
        String href = topic.getHref();
        String label = topic.getLabel();
        // Remove any special markings from the label
        String labelAsKey = cleanLabel(label).toLowerCase();
        String labelAsModifier = labelAsKey;
        if (Character.isDigit(labelAsModifier.charAt(0))) {
          labelAsModifier = '_' + labelAsModifier;
        }
        if (topics.contains(labelAsModifier)) {
          // append the parent topic name to this label
          ITopic parent = (ITopic) ((Topic) topic).getParentElement();
          String parentLabel = cleanLabel(parent.getLabel())
              .toLowerCase();
          if (Character.isDigit(parentLabel.charAt(0))) {
            parentLabel = '_' + parentLabel;
          }
          labelAsModifier = parentLabel + labelAsModifier;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.