queue

Pause MDB message Processing

我的未来我决定 提交于 2020-02-23 04:07:13
问题 Can we pause the MDB message processing for some time? For example: Jboss 1-deployed MDB for message processing. Jboss 2:-Bean for gathering user details. If the MDB from jboss 1 calls bean in jboss 2 for getting users details. If this is the case, when we restart the Jboss 2, we need to pause the MDB in jboss 1 till the jboss 2 is UP. Is there any option to pause MDB, so that we can avoid failure of message? 回答1: I doubt you can stop an MDB without stopping the whole application. It is

Implementing queue for image processing in Laravel - what to queue and what not to?

穿精又带淫゛_ 提交于 2020-02-07 05:33:27
问题 I have a Laravel based application which is image intensive. Users can upload images to the server and the images are stored on Amazon s3 bucket after being resized. The process is pretty slow here and I've been reading up on queues and think they may be exactly what i need to kind of delegate the part of storing on amazon to. The only thing is that this is my postAction which handles the uploading: public function postImage(){ $images = Input::only('images'); $model->saveImages($images[

Implementing queue for image processing in Laravel - what to queue and what not to?

主宰稳场 提交于 2020-02-07 05:33:06
问题 I have a Laravel based application which is image intensive. Users can upload images to the server and the images are stored on Amazon s3 bucket after being resized. The process is pretty slow here and I've been reading up on queues and think they may be exactly what i need to kind of delegate the part of storing on amazon to. The only thing is that this is my postAction which handles the uploading: public function postImage(){ $images = Input::only('images'); $model->saveImages($images[

Can I reverse a queue without using stack?

戏子无情 提交于 2020-02-02 12:57:07
问题 I have a queue with some numbers for example 5,6,7,8 is in queue, 5 is q->front and 8 is q->rear.. Can I reverse them in queue but without using stacks? 回答1: Of course! But it won't be as efficient. Using a stack: O(N) time. O(1) memory. Using an associative array: O(N) time. O(1) memory. Using a fixed-size array: O(N) time. O(N) memory. Using an extendable array: O(N) time. O(N) memory. Using a queue: O(N^2) time. O(1) memory. Using an associative array will use more time than using a stack,

Can I reverse a queue without using stack?

大城市里の小女人 提交于 2020-02-02 12:54:11
问题 I have a queue with some numbers for example 5,6,7,8 is in queue, 5 is q->front and 8 is q->rear.. Can I reverse them in queue but without using stacks? 回答1: Of course! But it won't be as efficient. Using a stack: O(N) time. O(1) memory. Using an associative array: O(N) time. O(1) memory. Using a fixed-size array: O(N) time. O(N) memory. Using an extendable array: O(N) time. O(N) memory. Using a queue: O(N^2) time. O(1) memory. Using an associative array will use more time than using a stack,

How to realize a persistent queue on Android

廉价感情. 提交于 2020-02-01 03:25:06
问题 My application needs a data structure similar to a queue: put data in it, receive data from it, FIFO-like. With data I mean simple strings for now, later on perhaps more complex objects. The thing is that the queue and its content should be persistent, regardless of what Android is doing. If the application gets closed and reopened (or even Android reboots), the queue should have the same state and data it had before the application was closed. I think the queue has to use some kind of

In Java, why is it that a Stack is a concrete class whereas the Queue is an interface?

こ雲淡風輕ζ 提交于 2020-01-24 04:38:06
问题 Which one of Queue's subclasses is a 'plain ordinary' queue? 回答1: (1) java.util.Stack is a legacy class from Java 1.0. It predates the Collections framework by many years, and it's frankly an example of horrible design on many fronts. Nothing about it is the way things should be. The main problem is that Stack extends Vector , and as all inheritance in Java is public inheritance, all the methods of Vector are available on Stack as well. Therefore, you can inspect any position in a Stack, add

Deque vs Queue Speed

…衆ロ難τιáo~ 提交于 2020-01-23 07:33:04
问题 I was working on a problem on LeetCode (Here). When I finished the problem, I came up with: class MovingAverage { std::deque<int> numsToAverage; int maxSize; int currentTotal; public: /** Initialize your data structure here. */ MovingAverage(int size) { maxSize = size; currentTotal = 0; } double next(int val) { currentTotal += val; numsToAverage.push_back(val); if (numsToAverage.size() > maxSize) { currentTotal -= numsToAverage[0]; numsToAverage.pop_front(); } return (double)currentTotal /

Deque vs Queue Speed

时光毁灭记忆、已成空白 提交于 2020-01-23 07:32:11
问题 I was working on a problem on LeetCode (Here). When I finished the problem, I came up with: class MovingAverage { std::deque<int> numsToAverage; int maxSize; int currentTotal; public: /** Initialize your data structure here. */ MovingAverage(int size) { maxSize = size; currentTotal = 0; } double next(int val) { currentTotal += val; numsToAverage.push_back(val); if (numsToAverage.size() > maxSize) { currentTotal -= numsToAverage[0]; numsToAverage.pop_front(); } return (double)currentTotal /

How Does Deque Work in Python

左心房为你撑大大i 提交于 2020-01-22 16:00:35
问题 I am having trouble understanding how the deque works in the snippet of code below, while trying to recreate a queue and a stack in Python. Stack Example - Understood stack = ["a", "b", "c"] # push operation stack.append("e") print(stack) # pop operation stack.pop() print(stack) As expected when pushing and popping, the "e" goes Last In, First Out (LIFO). My question is with the example below. Queue Example - Not Understanding from collections import deque dq = deque(['a','b','c']) print(dq)