Package java.util

Examples of java.util.Dictionary


      Thread synchDeliver = new Thread() {
          public void run() {

            for (int i = 0; i < messageTosend; i++) {
              /* a Hash table to store message in */
              Dictionary message = new Hashtable();
              /* put some properties into the messages */
              message.put("Synchronus message", new Integer(i));
              /* send the message */
              System.out.println(getName()
                                 + " sending a synchronus event with message:"
                                 + message.toString() + "and the topic:"
                                 + topicToSend);
              eventAdmin.sendEvent(new Event(topicToSend, message));
            }
          }
        };

      synchDeliver.start();
      synchDeliver.join();

      Thread asynchDeliver = new Thread() {
          public void run() {

            for (int i = 0; i < messageTosend; i++) {
              /* create the hasht table */
              Dictionary message = new Hashtable();
              /* create the message */
              message.put("Asynchronus message", new Integer(i));
              /* Sends a synchronous event to the admin */
              System.out.println(getName()
                                 + " sending an Asynchronus event with message:"
                                 + message.toString() + "and the topic:"
                                 + topicToSend);
              eventAdmin.postEvent(new Event(topicToSend, message));
            }
          }
        };
View Full Code Here


    public void runTest() throws Throwable {
      asynchMessages = 0;
      synchMessages = 0;
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* determine what topicType to use */
      if (useCorrectTopicType) {
        /* put service.pid property in hashtable */
        props.put(EventConstants.EVENT_TOPIC,
                  topicsToConsumeStringArray);
      } else {
        /* put service.pid property in hashtable */
        props.put(EventConstants.EVENT_TOPIC, topicsToConsumeArrayList);
      }

      /* register the service */
      serviceRegistration = bundleContext.registerService(
                                                          EventHandler.class.getName(), this, props);
View Full Code Here

      Thread synchDeliver = new Thread() {
          public void run() {
            /* deliver the messages */
            for (int i = 0; i < messageTosend; i++) {
              /* a Hash table to store message in */
              Dictionary message = new Hashtable();
              /* put some properties into the messages */
              message.put("Synchronus message",new Integer(i));
              /* send the message */
              eventAdmin.sendEvent(new Event("com/acme/timer", message));

            }
          }
View Full Code Here

      if (eventAdmin == null) {
        fail(getName() + " event admin should not be null");
      }

      /* a Hash table to store message in */
      Dictionary message = new Hashtable();
      for(int j = 0; j < propertiesToSend.length; j += 2) {
        /*fill the propstable*/
        System.out.println("Adding the following to the propsTable:" + propertiesToSend[j] + " and " + propertiesToSend[j+1]);
        message.put(propertiesToSend[j], propertiesToSend[j+1]);
      }

      for (int i = 0; i < messageTosend; i++) {
        message.put("Synchronus message",new Integer(i));
        /* test print out */
        System.out.println(getName() + " sending a Synchronus event with message:" +
                           message.toString() + "and the topic:" + topicToSend);
        /* send the message */
        eventAdmin.sendEvent(new Event(topicToSend, message));
      }


      /* a Hash table to store message in */
      message = new Hashtable();
      for(int j = 0; j < propertiesToSend.length;  j += 2) {
        /*fill the propstable*/
        System.out.println("Adding the following to the propsTable:" + propertiesToSend[j] + " and " + propertiesToSend[j+1]);
        message.put(propertiesToSend[j], propertiesToSend[j+1]);
      }

      for (int i = 0; i < messageTosend; i++) {
        message.put("Asynchronus message",new Integer(i));
        /* test print out */
        System.out.println(getName() + " sending an Asynchronus event with message:" +
                           message.toString() + "and the topic:" + topicToSend);
        /* send the message */
        eventAdmin.sendEvent(new Event(topicToSend, message));
      }

    }
View Full Code Here

          public void run() {
            int i = 0;
            while (!stopped && !Thread.interrupted()) {
              try {
                /* a Hash table to store message in */
                Dictionary message = new Hashtable();
                /* put some properties into the messages */
                message.put("Synchronus message", new Integer(i));
                /* send the message */
                System.out
                  .println(getName()
                           + " sending a synchronus event with message:"
                           + message.toString()
                           + "and the topic:" + topicToSend);
                eventAdmin
                  .sendEvent(new Event(topicToSend, message));
                /* Puts the thread to sleep for 10 seconds */
                i++;
                Thread.sleep(10000);
              } catch (InterruptedException e) {
                //ignored, treated by while loop
              }
            }
          }
        };

      synchDeliver.start();

      asynchDeliver = new Thread() {
          public void run() {
            int i = 0;
            while (!stopped && !Thread.interrupted()) {
              try {
                /* a Hash table to store message in */
                Dictionary message = new Hashtable();
                /* put some properties into the messages */
                message.put("Asynchronus message", new Integer(i));
                /* send the message */
                System.out
                  .println(getName()
                           + " sending a asynchronus event with message:"
                           + message.toString()
                           + "and the topic:" + topicToSend);
                eventAdmin
                  .sendEvent(new Event(topicToSend, message));
                /* Puts the thread to sleep for 10 seconds */
                i++;
View Full Code Here

    /**
     * run the test
     */
    public void runTest() throws Throwable {
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);
      /* register the service */
      serviceRegistration = bundleContext.registerService
        (EventHandler.class.getName(), this, props);

      assertNotNull(getName()
View Full Code Here

    public void runTest() throws Throwable {
      asynchMessages = 0;
      synchMessages = 0;
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* determine what topicType to use */
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);

      /* register the service */
      serviceRegistration = bundleContext.registerService(
                                                          EventHandler.class.getName(), this, props);

View Full Code Here

    public void runTest() throws Throwable {
      asynchMessages=0;
      synchMessages=0;
      unidentMessages=0;
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);
      /*if the filter to consume isn't null */
      if (filterToConsume != null){
        /* put service.pid property in hashtable */
        props.put(EventConstants.EVENT_FILTER, filterToConsume);
      }

      /* register the service */
      serviceRegistration = bundleContext.registerService(
                                                          EventHandler.class.getName(), this, props);
View Full Code Here

    public void runTest() throws Throwable {
      asynchMessages = 0;
      synchMessages = 0;
      /* create the hashtable to put properties in */
      Dictionary props = new Hashtable();
      /* determine what topicType to use */
      /* put service.pid property in hashtable */
      props.put(EventConstants.EVENT_TOPIC, topicsToConsume);

      /* register the service */
      serviceRegistration = bundleContext.registerService(
                                                          EventHandler.class.getName(), this, props);

View Full Code Here

    public void run() {

      int i = 0;
      while (i<2000) {
        /* a Hash table to store message in */
        Dictionary message = new Hashtable();
        /* put some properties into the messages */
        message.put("message", new Integer(i));
        /* put the sender */
        message.put("FROM", this);


        if (publisherId <= 2) {
          /* send the message */
          eventAdmin
View Full Code Here

TOP

Related Classes of java.util.Dictionary

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.