Adaptable Priority Queue ?

I'm working on a program where I am creating an adaptable priority queue with heaps and I implement the heaps with linked binary trees. Know of any good examples or links on the subject? I know fundamentally what do do, but the syntax is the issue. Thanks for any help.......

http://java.sun.com/j2se/1.5.0/docs/api/java/util/PriorityQueue.html

Similar Messages

  • Here's A Question Using A Priority Queue and a DLL

    Ifm trying to make a method that compares two objects that go into a DLL using a priority Queue. SO in other words lets say i have "5" go ino the DLL and then i have "2" that goes in i need to swap the 2 and the 5. And this goes on for any other objects inserted
         private Comparable minPosition() throws EmptyPriorityQueueException {
         if (size() == 0)
         throw new EmptyPriorityQueueException ("No Elements In The Queue");
         else
    now this is what i got so far....but i know that i have toi make to vaiables and compare them? little help please?
    Thanks

    Um, well im using the adapter class, List. so ive gone a bit further, but im not sure on what to do.....
         private Comparable minPosition() throws EmptyPriorityQueueException {
         if (size() == 0)
         throw new EmptyPriorityQueueException ("No Elements In The Queue");
         while (isEmpty()==false)
         r = ((Comparable)elements.first());
         s = ((Comparable)elements.next(elements));
    then i can make r=s and make s serach for the next element,?
    Can the experienced programmers help me out? Doesn't seem to be a tuff question.

  • Adapter engine queue monitoring

    Hi All,
    I have one doubt about adapter engine queue.
    We can see adapter engine queue in  RWB->Message Monitoring-> Adapter engine-> Display  .
    Here in queue if one message goes in to system error status, remaining all messages from that queue goes on holding status.
    So unless someone manually clears this system error message, remaining messages from same queue will not be processed.
    Is there anything to automate this process? Because currently someone has to manually monitor this queue and clear the message if it is in system error.
    Thanks in advance.
    Warm Regards,
    Gouri

    Hi Bhavesh,
    I am getting a PO file from source system which contains data and control record. But target system expects two different files for data and control. So in mapping program I have done this.
    When interface split happens for one scenario and the multiple messages are going to the same receiver, an internal queue name is generated from the message ID of the original message, to ensure that the correct processing sequence is maintained. As a result, the quality of service switches from EO to EOIO. Here is the reference link:
    http://help.sap.com/saphelp_nw04/helpdata/en/28/68073c8e56f658e10000000a114084/frameset.htm
    Also can you please elaborate on CCMS?
    Thanks in advance.
    Warm Regards,
    Gouri

  • Adapter Engine Queue

    Hi.
    I got yhe following error in default trace.
    ==========
    Could not get next EOIO QueueMessage from MessageStore. Reason: com.sap.aii.af.ra.ms.api.MessagingException: Error retrieving message from database store. Reason: Could not create Message. Reason: com.sap.aii.af.ra.ms.api.MessagingException: Could not parse XMBMessage due to Binary index out of range: 1613824 Putting message back into sequencer for manual retry.#
    #1.5
    ==========
    I check the
    http://<host>:<port>/MessagingSystem/monitor/systemStatus.jsp, and found the following information.
    ?EOIO   Status   HOLD  -> 1
    ?????????   TBDL  -> 1
    ?Matrix  one of the Adapter
    ???????????TBDL -> 6
    ???????????Size -> 161384
    I think the Adapter Engine queue size is overflow.
    (It is 161384).
    Question1
    How can I restart this "TBDL" message?
    I tried to restart from RWB -> message monitoring,
    but could not deliver cause of error.
    Question2
    How can I change the "queue size"?
    There are documents that refer to "thread count",
    not but "queue size".
    The thread count is default. It's "5".
    best regards,

    Thank you for your replying.
    I retry the message, but the error occured again.
    I check this message by performance monitoring on RWB.
    Nomarry this inerface process the "5 messsages" at one time.
    The average message size is "2MB".
    The "TBDL" message size is 2MB(I mean average size),
    but the number of the message is "19"!!
    Should I increase the number of threads?
    regards,

  • Java priority queue

    Java provides PriorityQueue, and I have gone through its API.
    The implementation of PriorityQueue in Java does not provide method for increase or decrease key,
    and there must be a reason for it.
    But, when i go through books on data strucutre, a lot of them talk about the increase/decrease key function
    of the PriorityQueue.
    So I am just wondering, why is it that increase/decrease function not provided in PriorityQueue. I cannot come up with a reason for it, but i think there must be. Does anybody have any thought on this. Or is it just
    because the designers thought its not needed?
    I checked the source for the Priority Queue and the heapify() method was declared private.

    lupansansei wrote:
    I have used Java's priority queue an I have written my own but I have never come accros the terms "increase or decrease key". Do you mean something like 'upheap' or 'downheap' in relation to a 'heap' implementation meaning move an entry to it correct position if the key changes? If so then one should make the 'key' immutable so that the functions are not needed.
    Yes, i mean 'upheap' or 'downheap' by increase or decrease key. Sorry
    maybe my choice of words was not correct.
    I couldn't get what you mean by 'key' immutable. Can you please explain it. If the key cannot change (i.e. it is immutable) then there is no need to ever change the position of an element.
    >
    Correct. Since the PriorityQueue does not need to implemented using a 'heap' there is no need for the heapify() method to be exposed. If one implemented using a balanced tree or a skip list the heapify() method would not be applicable.I am using PriorityQueue and i need to update the priority of the elements and i was wondering whether to implement the whole queue
    myself or look for a better way of using the PriorityQueue class.
    Do you have any suggestions for efficiently updating the priority of element?I have a priority queue implementation where elements know they are in a heap and know where they are in the heap. By doing this I can modify 'keys' and then move a value to it's correct place in the queue in a very short time. The limitations this feature imposes on the elements and the possibility of corrupting the heap means I don't often use this these days. It is far too error prone.
    These days in my simulations I normally remove an element from the queue, process the element and then create new elements and insert them back in the queue. This sometimes takes 2 lots of Log(n) operations where my specialized priority queue just takes Log(n) operations. The code is just so much more maintainable and I accept the hit.

  • Does the priority queue always work?

    Hi 
    I have a 8Mbp of wan link which sometime gets saturated and I have shaped average this to 8Mbps but i am running vocie on this WAN link and have defined priority for voice with 850kbps under voice class. My question is when the link is not fully utilized, Will the packets from priority queue are always dequeued first as compared to packets sent from from other queus or will the QoS will not do anything here since the link utilization is lot less than what is sepecified in shape average. I am asking this to confirm if the priority queue always help to overcome the issue of jitter if either the link is saturated or not?
    Thanks

    Disclaimer
    The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
    Liability Disclaimer
    In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
    Posting
    You describe PQ and shaping, but the former is usually a part of doing QoS on L2/L3 switches, and the latter on routers.  What device(s) and their IOS versions and the WAN media are you working with?
    On "routers", interfaces generally have FIFO tx-rings, only when they overflow, are packets placed in CBWFQ queues.  Within CBWFQ, LLQ will be dequeued first, but such packets might have already been queued behind other non-LLQ traffic within the interface tx-ring.  (NB: for routers, with tx-rings, when supporting VoIP, you may want to minimize the size of the tx-ring.)
    Shapers, in my experience, are "interesting".  First, I believe many shapers don't account for L2 overhead, but provider CIRs often do.  So unless you shape slower than the nomimal CIR rate, you can send faster than the available bandwidth.  (Often I've found shaping 10 to 15% slower allows for average L2 overhead.)
    Second, shapers work on averages over time intervals.  For VoIP, you'll often want to insure the shaper is using a small Tc, otherwise it will allow FIFO bursts.  (I've found a Tc of 10ms seems to support VoIP fairly well.)
    Third, I suspect some shapers might have their own queues between the interface and the defined policy queues.  If they do, unknown what their queuing organization is or their supported queuing depths.  If this is the case, makes it difficult to engineer QoS.
    Whenever possible, I've found it beneficial to work to avoid using shapers especially for timing sensitive traffic, like VoIP.  In your case, I would suggest, if possible, obtaining 10 Mbps of WAN bandwidth and somewhere passing the traffic through a physical 10 Mbps interface, with a QoS policy.
    But to more directly answer your question, PQ (or LQ) will dequeue its packets next compared to other "peer" queues.  This should always help VoIP for delay and jitter, but there's more involved whether this is necessary and/or whether it's helpful enough when necessary.
    You ask about when a link is saturated, but a link is 100% saturated everytime a packet is being transmitted.  Often link usage is represented in percentages of usage of possible maximum transmission rate over some time period, but when it comes to QoS, 100% utilization might be just fine while 1% utilization is not.  Much, much more information, about your situation, might be needed to offer truly constructive recommendations.

  • Custom  order of priority queue

    I am a novice in Java. I intend to use a priority queue which holds objects. The objects have a string and two integers. I have to order the priority queue based on one of the integer.
    I write syntax according to my understanding please correct me.
    PriorityQueue<Object> pr = new PriorityQueue<Object>();
    comparable(){
    sort(Object.int2)// this is the place where I am confused
    }

    Here's an example:
    public class Caller
        public static void main(String[] args)
            Flight f1 = new Flight( "java", 2, 34 );
            Flight f2 = new Flight( "java", 2, 3 );
            Flight f3 = new Flight( "java", 2, 4 );
            Flight f4 = new Flight( "java", 2, 64 );
            Flight f5 = new Flight( "java", 2, 22 );
            Flight f6 = new Flight( "java", 2, 12 );
            PriorityQueue pq = new PriorityQueue();
            pq.add(f1);
            pq.add(f2);
            pq.add(f3);
            pq.add(f4);
            pq.add(f5);
            pq.add(f6);
            System.out.println(pq.poll());
            System.out.println(pq.poll());
            System.out.println(pq.poll());
            System.out.println(pq.poll());
            System.out.println(pq.poll());
            System.out.println(pq.poll());
    public class Flight implements Comparable
        private String airlinename;
        private int flightnumber;
        private int number;
        public int compareTo(Object o)
            Flight f = (Flight) o;
            return number - f.getNumber();
        public String toString()
            return airlinename + " - " + number;
        public Flight(String airname, int num1, int num2)
            airlinename = airname;
            flightnumber = num1;
            number = num2;
        public String getAirlinename()
            return airlinename;
        public void setAirlinename(String airlinename)
            this.airlinename = airlinename;
        public int getFlightnumber()
            return flightnumber;
        public void setFlightnumber(int flightnumber)
            this.flightnumber = flightnumber;
        public int getNumber()
            return number;
        public void setNumber(int number)
            this.number = number;
    }Got it?

  • Priority Queues

    hi iam a beginner in java, could you please help me with this code. thanks
    Implement (provide complete Java code) a priority queue using a singly linked list. You may call this class LinkedPriorityQueue. The use of classes contained in the Java Collections framework in the above implementing is strictly forbidden.
    You may need to write a second class, PQNode, which defines the nodes in your linked list. Feel free to implement the PQNode class in anyway that you see fit. However, the LinkedPriorityQueue class should implement all methods and constructors

    Here is the search of the forums
    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%22singly+linked+list%22&col=javaforums&x=23&y=16
    Here is a google search
    http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=%22singly+linked+list%22+java
    Due tomorrow???

  • Deleting Adapter engine queues

    Hi Experts,
                     While trying a proxy to database scenario My message is (processed Successfully in SXMB_MONI) getting stuck in Receiver JDBC channel and the status of the message is DELEIVERING. How can i delete the messages from the adapter engine queue. I am trying to cancel the messages from the Message monitoring in the RWB but i am not able to cancel that message due to which other messages are also in DELEIVERING state.
    Thanks
    Ajay

    Hi,
    1) How can i know the Queue ID in the Adapter engine as my message is processed succesfully from SAP-XI and stuck in adapter engine.
    A) See the Blog for this
    2) Is it mandatory that we have to clear the Very First message which is in the queue , means other messages which all are in DELIEVERING stage can't be deleted?
    A) YES, Its mandatory to clear the very first strucked message
    Regards
    Seshagiri

  • Priority Queue problem

    Hi Everybody.
    Can anyone tell me in which order elements of priority queue are sorted.
    I have used following code
    class Test{
    PriorityQueue <strings> pq=new PriorityQueue <Strings>();
    pq.add("silpa");
    pq.add("swati");
    pq.add("roopa");
    pq.add("abc");
    System.out.println(pq);
    System.out.println(pq.poll());
    System.out.println(pq.peak());
    The output I got is
    [abc silpa swathi roopa]
    abc
    roopa.
    Can anybody explain why the collection elements are not sorted ?
    I am getting correct output with peek() n poll().According that methods i should get
    [abc roopa silpa swathi ]
    Explain the reason?

    System.out.println(pq);This line prints out the contents of the queue, by implicitly calling pq.toString(), whose behaviour is inherited from AbstractCollection, which therefore has nothing to do with sorting. So you have no valid reason for expecting any particular ordering.

  • [svn] 3539: Updated RadioButtonGroup to account for recent changes to LayoutManager priority queue .

    Revision: 3539
    Author: [email protected]
    Date: 2008-10-09 10:58:31 -0700 (Thu, 09 Oct 2008)
    Log Message:
    Updated RadioButtonGroup to account for recent changes to LayoutManager priority queue. The order that a RadioButtonGroup was traversed was always dependent on what order that the radio buttons properties were validated. Since this assumption no longer holds true, we are now very specific about how the group orders the RadioButtons (breadth-first for consistency with Flex 2 and Flex 3).
    Check-in Tests: Pass
    Mustella Tests: (RadioButton, RadioButtonGroup) Pass
    Reviewer: Glenn
    QA: Yes
    Bugs: SDK-17248
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17248
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButtonGroup.as

    Revision: 3539
    Author: [email protected]
    Date: 2008-10-09 10:58:31 -0700 (Thu, 09 Oct 2008)
    Log Message:
    Updated RadioButtonGroup to account for recent changes to LayoutManager priority queue. The order that a RadioButtonGroup was traversed was always dependent on what order that the radio buttons properties were validated. Since this assumption no longer holds true, we are now very specific about how the group orders the RadioButtons (breadth-first for consistency with Flex 2 and Flex 3).
    Check-in Tests: Pass
    Mustella Tests: (RadioButton, RadioButtonGroup) Pass
    Reviewer: Glenn
    QA: Yes
    Bugs: SDK-17248
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17248
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RadioButtonGroup.as

  • Low priority and high priority queue

    Hi
    we have high priority and low priority queue's. Functionality wise i know that time critical messages will be sent through high priority queue's and low priority messages will be sent
    through low priority queues. But like to know what technicality makes this separation of
    low priority and high priority queue's ? The crus of the question is what technical setting(s)
    makes the queue as high priority and what technical setting(s) makes the queue as low priority
    queue.
    Thanks
    kumar

    i Michal
    I am talking abt queue prioritization on Integration eninge only.
    I am good with queue prioritization and am able to successfully implement
    the same. We are using only PI7.0.
    My question is what is the technical difference between high priority
    and low priority queues ? what technical setting makes it a high priority
    queue and what technical setting makes a low priority queue ?
    Your answer:
    how the system reacts to new messages if almost all queues are already blocked
    for some types of messages
    My comment: what setting makes the system to behave like that ? what property
    of that queue makes them to behave like that ?
    Thanks
    kumar

  • Egress queueing - priority-queues and queue-sets

    If I use the priority-queue out command on an interface 3750 does this treat queue1 as the priority queue?
    How can I tell which traffic is sent to each queue by default? Or do I have to specifically define it such as
    mls qos srr-queue output dscp-map queue 1 threshold 3 40 41 42 43 44 45 46 47
    I really want dscp 40-47 to go priority and the rest to be spread evenly across the other 3 queues as the vast majority of the rest of the traffic will be 0. Is there a command that lets the other 3 queues be best effort?
    Also, is this an OK config to use with priority-queueing? I don't actually want a large amount of bandwidth for the priority traffic, just for it to be expidited.
    Queueset: 2
    Queue : 1 2 3 4
    buffers : 10 30 30 30
    threshold1: 100 200 100 100
    threshold2: 100 200 100 100
    reserved : 50 50 50 50
    maximum : 400 400 400 400
    Any help very gratefully received.
    Thanks, J

    Sorry, just bouncing this to see if anyone around today can help :)

  • Multiple Priority Queues?

    All,
    I have read that one may configure up to 4 priority queues, not using the Modular QOS CLI (e.g. "priority-list" command, etc).
    For the Modular QOS CLI, PQs are implemented using LLQ ("priority" command), and for this one can only specify a single PQ (though multiple classes may be mapped to this single PQ).
    What I would like to do is to have 2 distinct PQs (as should be possible in the non modular cli case) and also use CBWFQ (e.g. "bandwidth" command) for the rest of the clases. Basically I want to have EF in one PQ, another "special" class in the other PQ (lower priority than EF), and AF classes using CBWFQ.
    Does anyone know of a way to combine the 2 methods (modular and non modular CLI) of configuring LLQ in order to implement such a configuration? I was encouraged to see that heirarchical policies are supported but so far I have not found a way to specify multiple PQs as well as CBWFQ.
    Thanks much!

    There has been alot of discussion on this subject. But it seems that while IOS will allow you to configure multiple priority queues, its not really possible for it to deliver multiple priority queues.
    Which, if you think about it makes sense. A priority queue is just that, it takes priority over all other queues. If you configue 2 priority queues, how would you then then tell the scheduler that these are both priority, but the 2nd is less of a priority?
    One way you can accomplish what you're trying to do:
    1. Create a single "priority" queue for your EF traffic
    2. Use "bandwidth" to guarantee bandwidth to your special class.
    3. Put your AF traffic in class-default and let it "fair-queue".
    Something like this:
    policy-map foo
    class EF
    priority 100
    class Special
    bandwith 50
    class class-default
    fair-queue
    -Geoff

  • Priority queues for external loading

    Hi, I was wondering if there was a way to load multiple external files (via the Loader class) in parrallel, but with a priority queue. That is, I want to load 5 images, but I want image 1 loaded as fast as possible.
    Obviously I could make my own load queue, but if I do that the loading process could easily get hung up on loading a single image.
    I want to be able to run multiple Loader.load()s in parrallel, but assign priority weighting to each of the files.

    i don't know of any way to pause a loading file with flash.   in as3 once a file starts to load you can either let it complete loading or you can stop its load.  if you stop its load and then later want to continue, you must restart from the begining.  i don't believe flash has any way to complete the load of a partially downloaded file.

Maybe you are looking for