Package com.nokia.dempsy.messagetransport

Examples of com.nokia.dempsy.messagetransport.Sender.send()


                  largeMessageBytes[i] = (byte)charSet.charAt(random.nextInt(charSet.length()));
              
               byte[] messageBytes = "Hello".getBytes();
              
               // send the message ... it should be sent without delay.
               sender.send(largeMessageBytes); // this should flush everything
               sender.send(messageBytes); // this should wait for another message.
               sender.send(messageBytes); // this should wait for another message.
               sender.send(largeMessageBytes); // this should flush everything

               // wait for it to be received.
View Full Code Here


              
               byte[] messageBytes = "Hello".getBytes();
              
               // send the message ... it should be sent without delay.
               sender.send(largeMessageBytes); // this should flush everything
               sender.send(messageBytes); // this should wait for another message.
               sender.send(messageBytes); // this should wait for another message.
               sender.send(largeMessageBytes); // this should flush everything

               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
View Full Code Here

               byte[] messageBytes = "Hello".getBytes();
              
               // send the message ... it should be sent without delay.
               sender.send(largeMessageBytes); // this should flush everything
               sender.send(messageBytes); // this should wait for another message.
               sender.send(messageBytes); // this should wait for another message.
               sender.send(largeMessageBytes); // this should flush everything

               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() < 4;)
View Full Code Here

              
               // send the message ... it should be sent without delay.
               sender.send(largeMessageBytes); // this should flush everything
               sender.send(messageBytes); // this should wait for another message.
               sender.send(messageBytes); // this should wait for another message.
               sender.send(largeMessageBytes); // this should flush everything

               // wait for it to be received.
               for (long endTime = System.currentTimeMillis() + baseTimeoutMillis;
                     endTime > System.currentTimeMillis() && receiver.numMessages.get() < 4;)
                  Thread.sleep(1);
View Full Code Here

               DefaultDempsyExecutor executor = ((DefaultDempsyExecutor)adaptor.executor);
              
               // first dump the max number of messages
               for (int i = 0; i < executor.getMaxNumberOfQueuedLimitedTasks(); i++)
                  sender.send("Hello".getBytes());
              
               // wait until there's room in the queue due to messages being passed on to
               // the receiver; one for each thread.
               assertTrue(TestUtils.poll(baseTimeoutMillis, receiver, new TestUtils.Condition<StringListener>()
                     { @Override public boolean conditionMet(StringListener o) { return o.numIn.get() == numAdaptorThreads; } }));
View Full Code Here

               assertTrue(TestUtils.poll(baseTimeoutMillis, receiver, new TestUtils.Condition<StringListener>()
                     { @Override public boolean conditionMet(StringListener o) { return o.numIn.get() == numAdaptorThreads; } }));
              
               // send one more for each opened up place in the queue now
               for (int i = 0; i < numAdaptorThreads; i++)
                  sender.send("Hello".getBytes());
              
               // wait until all Listeners are in and all threads enqueued. This is the totally full state.
               assertTrue(TestUtils.poll(baseTimeoutMillis, ((DefaultDempsyExecutor)adaptor.executor), new TestUtils.Condition<DefaultDempsyExecutor>()
                     { @Override public boolean conditionMet(DefaultDempsyExecutor o) { return o.getNumberLimitedPending() == o.getMaxNumberOfQueuedLimitedTasks(); } }));
View Full Code Here

               assertTrue(TestUtils.poll(baseTimeoutMillis, statsCollector,
                     new TestUtils.Condition<BasicStatsCollector>() {
                  @Override public boolean conditionMet(BasicStatsCollector o) throws Throwable
                  {
                     sender.send("Hello".getBytes());
                     sender.send("Hello".getBytes());
                    
                     synchronized(latch)
                     {
                        latch.notify(); // single exit.
View Full Code Here

               assertTrue(TestUtils.poll(baseTimeoutMillis, statsCollector,
                     new TestUtils.Condition<BasicStatsCollector>() {
                  @Override public boolean conditionMet(BasicStatsCollector o) throws Throwable
                  {
                     sender.send("Hello".getBytes());
                     sender.send("Hello".getBytes());
                    
                     synchronized(latch)
                     {
                        latch.notify(); // single exit.
                     }
View Full Code Here

               logger.error("Couldn't figure out a means to send " + SafeString.objectDescription(message) +
                     " to " + SafeString.valueOf(destination) + "");
            else
            {
               byte[] data = serializer.serialize(message);
               sender.send(data); // the sender is assumed to increment the stats collector.
               messageFailed = false;
            }
         }
         catch(DempsyException e)
         {
View Full Code Here

      try
      {
         setUp2("/blockingqueueTest2AppContext.xml");
         Destination destination = destinationFactory.getDestination();
         Sender lsender = senderFactory.getSender(destination);
         lsender.send("Hello".getBytes());
         String message = new String( pojo.getMessage() );
         assertEquals("Hello", message);
         assertEquals(0, overflowHandler.overflowCalled);
      }
      finally
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.