Examples of Queue


Examples of br.org.scadabr.dnp34j.master.common.utils.Queue

    // setDataMap(new DataMap(config));

    userSndLock = new Lock(UNLOCKED);
    userRcvLock = new Lock();
    userRcvBuffer = new Buffer(M);
    userRcvQueue = new Queue();

    // appRcv = new AppRcv();

    setAppSnd(appRcv.getAppSnd());
View Full Code Here

Examples of com.Acrobot.ChestShop.DB.Queue

                config.getString("database.isolation")
        );

        database = DB.getDatabase();

        scheduleTask(new Queue(), 200L, 200L);
    }
View Full Code Here

Examples of com.cloudhopper.mq.queue.Queue

    }

    synchronized private void startLocalToRemoteQueueProcessor(String queueName) {
        // get the local queue
        Queue localQueue = null;

        try {
            localQueue = queueManager.getQueue(queueName);
        } catch (QueueInvalidStateException e) {
            logger.error("Unable to complete startLocalToRemoteQueueProcessor since QueueManager is in an invalid state", e);
            return;
        }

        // if no local queue, silently ignore this event?
        if (localQueue == null) {
            logger.warn("Unable to complete startLocalToRemoteQueueProcessor since local queue [" + queueName + "] does not exist - perhaps a delayed event?");
            return;
        }

        // if there is a local consumer for this queue, we need to ignore this
        if (localQueue.getConsumerCount() > 0) {
            logger.warn("Ignoring request to startLocalToRemoteQueueProcessor for queue [" + queueName + "]: there are currently [" + localQueue.getConsumerCount() + "] local consumers");
            return;
        }

        // make sure there is a remote queue
        RemoteQueueInfo remoteQueue = dqs.getRemoteQueue(queueName);

        if (remoteQueue == null) {
            logger.error("Ignoring request to startLocalToRemoteQueueProcessor for queue [" + queueName + "]: there is no remote queue for it in DistributedQueueState");
            return;
        }

        if (remoteQueue.isNotAvailable()) {
            logger.error("Ignoring request to startLocalToRemoteQueueProcessor for queue [" + queueName + "]: the remote queue is not available (perhaps it flapped?)");
            return;
        }

        // is there already a processor?
        LocalToRemoteQueueProcessor queueProcessor = this.queueProcessors.get(queueName);

        if (queueProcessor != null) {
            // is it still alive?
            if (!queueProcessor.isKilled() && queueProcessor.isAlive()) {
                logger.error("Ignoring request to startLocalToRemoteQueueProcessor for queue [" + queueName + "]: the processor already exists and is still alive");
                return;
            }
        }

        logger.debug("Creating and starting LocalToRemoteQueueProcessor for queue [" + localQueue.getName() + "]");

  try {
      // create a new processor
      queueProcessor = new LocalToRemoteQueueProcessor(this, localQueue, remoteQueue, httpFactory);
     
View Full Code Here

Examples of com.davfx.ninio.common.Queue

    return this;
  }
 
  @Override
  public void connect(final TelnetClientHandler clientHandler) {
    final Queue q;
    final boolean shouldCloseQueue;
    if (queue == null) {
      try {
        q = new Queue();
      } catch (IOException e) {
        clientHandler.failed(e);
        return;
      }
      shouldCloseQueue = true;
    } else {
      q = queue;
      shouldCloseQueue = false;
    }

    final Address a;
    if (host != null) {
      if (port < 0) {
        a = new Address(host, address.getPort());
      } else {
        a = new Address(host, port);
      }
    } else {
      a = address;
    }

    q.post(new Runnable() {
      @Override
      public void run() {
        ByteBufferAllocator allocator = new OnceByteBufferAllocator();
        Ready ready = readyFactory.create(q, allocator);
        ready.connect(a, new ReadyConnection() {
          private TelnetResponseReader reader = null;
          @Override
          public void handle(Address address, ByteBuffer buffer) {
            reader.handle(address, buffer);
          }
         
          @Override
          public void failed(IOException e) {
            if (shouldCloseQueue) {
              q.close();
            }
            clientHandler.failed(e);
          }
         
          @Override
          public void connected(FailableCloseableByteBufferHandler write) {
            reader = new TelnetResponseReader(clientHandler, write);
            clientHandler.launched(new TelnetClientHandler.Callback() {
              @Override
              public void close() {
                reader.close();
                if (shouldCloseQueue) {
                  q.close();
                }
              }
             
              @Override
              public void send(String line) {
                reader.send(line);
              }
            });
          }
         
          @Override
          public void close() {
            if (shouldCloseQueue) {
              q.close();
            }
            reader.close();
          }
        });
      }
View Full Code Here

Examples of com.deitel.jhtp6.ch17.Queue

public class QueueTest
{
   public static void main( String args[] )
   {
      Queue queue = new Queue()

      // use enqueue method
      queue.enqueue( -1 );
      queue.print();
      queue.enqueue( 0 );
      queue.print();
      queue.enqueue( 1 );
      queue.print();
      queue.enqueue( 5 );
      queue.print();

      // remove objects from queue
      try
      {
         Object removedObject = null;

         while ( true )
         {
            removedObject = queue.dequeue(); // use dequeue method
            System.out.printf( "%s dequeued\n", removedObject );
            queue.print();
         } // end while
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
View Full Code Here

Examples of com.enioka.jqm.jpamodel.Queue

    @Override
    public void setJobQueue(int idJob, int idQueue)
    {
        EntityManager em = null;
        JobInstance ji = null;
        Queue q = null;

        try
        {
            em = getEm();
            q = em.find(Queue.class, idQueue);
View Full Code Here

Examples of com.google.appengine.api.labs.taskqueue.Queue

    return "mq-high";
  }
 
  @Override
  public void publish(Message message) {
    Queue queue = getSystemService().getQueue(getQueueName(message));
    if (message.getTopic() == null) {
      logger.error("Topic is null in message " + message);
      return;
    }
    queue.add(url(MessageQueueServlet.MQ_URL)
        .param("message", Base64.encodeBase64(StreamUtil.toBytes(message))));
  }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.Queue

      // Get the prices and archive them
      query = "SELECT FROM " + Contract.class.getName() + " WHERE expiryDate>0 && archived==false ORDER BY expiryDate";
      print(query);
      PersistenceManager pm = PMF.get().getPersistenceManager();
      Query q = pm.newQuery(query);
      Queue queue = QueueFactory.getDefaultQueue();
      @SuppressWarnings("unchecked")
      List<Contract> results = (List<Contract>) q.execute();
      print("Putting in queue for processing " + results.size() + " contracts.");
      for (Contract c : results) {
        String contractid = c.getId();
        // print("Adding contract "+contractid+
        // " in the queue. Will not archive.");
        queue.add(Builder.withUrl("/processContractClosingPrices").param("contract", contractid).param("archive", "y")
            .param("time_threshold_minutes", threshold.toString()).method(TaskOptions.Method.GET));
        queue.add(Builder.withUrl("/processContractTrades").param("contract", contractid)
            .param("time_threshold_minutes", "1").method(TaskOptions.Method.GET));
      }
      pm.close();

      // Now get the remaining active contracts (that have not been
      // archived yet)
      // Do no archive yet.

      long now = (new Date()).getTime();
      query = "SELECT FROM " + Contract.class.getName() + " WHERE laststoredCSV<" + (now - Contract.time_threshold())
          + " && expiryDate==0 && archived==false  ORDER BY laststoredCSV";
      print(query);
      pm = PMF.get().getPersistenceManager();
      q = pm.newQuery(query);

      @SuppressWarnings("unchecked")
      List<Contract> results_remaining = (List<Contract>) q.execute();

      print("Putting in queue for processing " + results_remaining.size() + " contracts.");
      for (Contract c : results_remaining) {
        String contractid = c.getId();
        // print("Adding contract "+contractid+
        // " in the queue. Will not archive.");
        queue.add(Builder.withUrl("/processContractClosingPrices").param("contract", contractid).param("archive", "n")
            .param("time_threshold_minutes", threshold.toString()).method(TaskOptions.Method.GET));
        queue.add(Builder.withUrl("/processContractTrades").param("contract", contractid)
            .param("time_threshold_minutes", "1").method(TaskOptions.Method.GET));
      }
      pm.close();

      print("Done!");
View Full Code Here

Examples of com.kanner.domain.Queue

   * @param queue
   * @return
   */
  public String create(Queue queue) {
   
    Queue createdQueue = null;
   
    try {
     
      createdQueue = pm.makePersistent(queue);
     
    } finally {
     
      pm.close();
    }
   
    return createdQueue.getId();
  }
View Full Code Here

Examples of com.logica.smpp.util.Queue

   */
  public PduEventListener (boolean queueEnquireLink)
  {
    myQueueEnquireLink = queueEnquireLink;
    if (myQueueEnquireLink) {
      myEnquireLinkResponseEvents = new Queue ();
    }
  }
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.