Examples of Slot


Examples of EDU.oswego.cs.dl.util.concurrent.Slot

   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
      Destination topic = (Destination)ic.lookup("/topic/ATopic");

      Connection conn = cf.createConnection();
      Slot slot = new Slot();

      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer consumer = session.createConsumer(topic);
      consumer.setMessageListener(new SimpleMessageListener(slot));

      conn.start();

      Connection conn2 = cf.createConnection();
      Session session2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = session2.createProducer(topic);
      Message m = session.createTextMessage("blah");

      prod.send(m);

      TextMessage rm = (TextMessage)slot.poll(5000);

      assertEquals("blah", rm.getText());

      // Only for JBoss Remoting > 2.0.0.Beta1
      long sleepTime = ServerInvoker.DEFAULT_TIMEOUT_PERIOD + 60000;
      log.info("sleeping " + (sleepTime / 60000) + " minutes");

      Thread.sleep(sleepTime);

      log.info("after sleep");

      // send the second message. In case of remoting timeout, the callback server won't forward
      // this message to the MessageCallbackHandler, and the test will fail

      Message m2 = session.createTextMessage("blah2");
      prod.send(m2);

      TextMessage rm2 = (TextMessage)slot.poll(5000);

      assertNotNull(rm2);
      assertEquals("blah2", rm2.getText());

      conn.close();
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.Slot

      final MessageConsumer cons = session.createConsumer(queue);

      conn.start();

      final Slot slot = new Slot();

      new Thread(new Runnable()
      {
         public void run()
         {
            try
            {
               Message m = cons.receive(5000);
               if (m != null)
               {
                  slot.put(m);
               }
            }
            catch(Exception e)
            {
               log.error("receive failed", e);
            }

         }
      }, "Receiving Thread").start();


      Thread.sleep(500);

      MessageProducer prod = session.createProducer(queue);
      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

      TextMessage m = session.createTextMessage("message one");

      prod.send(m);

      TextMessage rm = (TextMessage)slot.poll(5000);

      assertEquals("message one", rm.getText());

      conn.close();
   }
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.Slot

      Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      MessageConsumer cons = session.createConsumer(queue);

      final Slot slot = new Slot();

      cons.setMessageListener(new MessageListener()
      {
         public void onMessage(Message m)
         {
            try
            {
               slot.put(m);
            }
            catch(InterruptedException e)
            {
               log.warn("got InterruptedException", e);
            }
         }
      });

      conn.start();

      MessageProducer prod = session.createProducer(queue);
      prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      TextMessage m = session.createTextMessage("one");
      prod.send(m);

      TextMessage rm = (TextMessage)slot.poll(5000);

      assertEquals("one", rm.getText());

      conn.close();
   }
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.Slot

   {
      private Slot slot;

      SimpleMessageListener()
      {
         slot = new Slot();
      }
View Full Code Here

Examples of EDU.oswego.cs.dl.util.concurrent.Slot

   {
      private Slot slot;

      SimpleMessageListener()
      {
         slot = new Slot();
      }
View Full Code Here

Examples of ch.njol.skript.util.Slot

    if (o instanceof String)
      return ((String) o).isEmpty();
    if (o instanceof Inventory)
      return !((Inventory) o).iterator().hasNext();
    if (o instanceof Slot) {
      final Slot s = (Slot) o;
      final ItemStack i = s.getItem();
      return i == null || i.getType() == Material.AIR;
    }
    return false;
  }
View Full Code Here

Examples of com.asakusafw.compiler.directio.emitter.Slot

            if (kinds.contains(OutputPattern.SourceKind.ENVIRONMENT)) {
                assert kinds.contains(OutputPattern.SourceKind.PROPERTY) == false;
                assert kinds.contains(OutputPattern.SourceKind.RANDOM) == false;
                assert desc.getOrder().isEmpty();
                String outputName = output.getDescription().getName();
                Slot slot = new Slot(
                        outputName,
                        output.getSources(),
                        Models.toName(f, desc.getModelType().getName()),
                        desc.getBasePath(),
                        desc.getResourcePattern(),
                        Models.toName(f, desc.getFormat().getName()),
                        null,
                        null,
                        desc.getDeletePatterns());
                slots.add(slot);
            } else {
                List<CompiledOrder> orderingInfo = OutputPattern.compileOrder(desc.getOrder(), dataType);
                String outputName = output.getDescription().getName();
                Name naming = namingEmitter.emit(outputName, slots.size() + 1, dataType, namingInfo);
                Name ordering = orderingEmitter.emit(outputName, slots.size() + 1, dataType, orderingInfo);
                Slot slot = new Slot(
                        outputName,
                        output.getSources(),
                        Models.toName(f, desc.getModelType().getName()),
                        desc.getBasePath(),
                        desc.getResourcePattern(),
View Full Code Here

Examples of com.asakusafw.compiler.flow.mapreduce.parallel.Slot

    }

    private Slot toSlot(Output output, String name) {
        assert output != null;
        assert name != null;
        return new Slot(
                name,
                output.getDescription().getDataType(),
                Collections.<String>emptyList(),
                output.getSources(),
                TemporaryOutputFormat.class);
View Full Code Here

Examples of com.asakusafw.compiler.flow.mapreduce.parallel.Slot

                getEnvironment().getBatchId(),
                getEnvironment().getFlowId());

        List<Slot> slots = Lists.create();
        for (Output output : context.getOutputs()) {
            Slot slot = toSlot(output);
            slots.add(slot);
        }
        List<ResolvedSlot> resolved = new SlotResolver(getEnvironment()).resolve(slots);
        if (getEnvironment().hasError()) {
            return Collections.emptyList();
View Full Code Here

Examples of com.asakusafw.compiler.flow.mapreduce.parallel.Slot

    }

    private Slot toSlot(Output output) {
        assert output != null;
        String name = normalize(output.getDescription().getName());
        return new Slot(
                name,
                output.getDescription().getDataType(),
                Collections.<String>emptyList(),
                output.getSources(),
                TemporaryOutputFormat.class);
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.