Collections.sort question

Hi,
This is my question. I have the following classes
class A {
     int num = 1;
class B extends A implements Comparable<B>{
   int count = 0;
   public int compareTo(B b) {
        return count - b.getCount;  
  public void setCount(int count) {
        this.count = count;
  public int getCount() {
         return count;
}After i put the a couple of the B classes (after setting count) in a LinkedList of type A, i get a problem trying to sort them. The compiler gives me a variable Collections error on the Collections.sort
Any ideas on how to solve this would be appreciated.
Thanks

Are you talking about this A* algorithm? (I've never heard of it before.)
http://en.wikipedia.org/wiki/A-star_search_algorithm
The code you have with the "instanceof" test might work. Not sure what the goal is, or how the algorithm works (I didn't read the above link in detail), so I can't say for sure whether it will "work" for what you are doing. Once you sort the "B" objects, what do you need to do with that sublist (i.e., with the bList in your code)?
I've never used generics, so I don't know much about them. Is it possible to make "A" Comparable, giving a dummy implementation to compareTo (i.e., maybe even just make it always return '0' [all values are equal]), and then have "B" implement Comparable such that B's compareTo will override A's version? I don't know if it is possible (or even desirable)--just a thought.

Similar Messages

  • Error in proposed Collections.sort signature

    (A very long time ago I've send a note on this to the jsr comment list, but unfortunately I never got a reply nor did I notice a bug report. Therefore I propose the change again here).
    The signature of the Collections.sort method is very limiting:
      static <T> void sort(List<T> list, Comparator<T> c);This signature requires you to pass a Comparator that is parameterized with exactly the same type as the items in the List. However, often Comparators can be implemented more generic. The signature doesn't allow this. The only requirement for the sort algorithm is however to pass a Comparator that is able to compare the items in the List.
    This requirement is expressed by the following signature:
      static <T, E extends T> void sort(List<E> list, Comparator<T> comparator) The items in the List are now allowed to be more specific. Because I don't want to cast in Generic Java code I've implemented a tiny workaround:
      public static <T, E extends T> void sort(List<E> list, Comparator<T> comparator) {
        Collections.sort(list, new ComparatorWrapper<T, E>(comparator));
      private static class ComparatorWrapper<T, E extends T> implements Comparator<E> {
        private Comparator<T> _comparator;
        public ComparatorWrapper(Comparator<T> comparator) {
          super();
          _comparator = comparator;
        public int compare(E o1, E o2) {
          return _comparator.compare(o1, o2);
      }This proves the correctness of the new signature. This also proves that you have to be very careful in chosing a signature. I've been working with Generic Java for some years now, but I'm still making the same mistake now and then ...

    This will be fixed in a novel and interesting way in the new spec for GJ -- stay tuned! (I think mid-May/late-May is the expected timeframe for this.)

  • N^2 log(n) for Collections.sort() on a linked list in place?

    So, I was looking over the Java API regarding Collections.sort() on linked lists, and it says it dumps linked lists into an array so that it can call merge sort. Because, otherwise, sorting a linked list in place would lead to a complexity of O(n^2 log n) ... can someone explain how this happens?

    corlettk wrote:
    uj,
    ... there are other sorting methods for linked lists with an O(N*N) complexity.Please, what are those algorithms? I'm guesing they're variants off insertion sort, coz an insertion is O(1) in a linked list [and expensive in array]... Am I warm?You don't have to change the structure of a linked list to sort it. You can use an ordinary Bubblesort. (The list is repeatedly scanned. In each scan adjacent elements are compared and if they're in wrong order they're swapped. When one scan of the list passes without any swaps the list is sorted). This is an O(N*N) algoritm.
    What I mean is it's possible to sort a list with O(N*N) complexity. It doesn't have to be O(N*N*logN) as the Java documentation kind of suggests. In fact I wouldn't be surprised if there were special O(N*logN) algoritms available also for lists but I don't know really. In any case Java uses none of them.

  • Collections.sort() - sort on multiple fields?

    I have a collection of objects in a List that I need to be able to sort on each field individually. For example, the data in the List is eventually displayed on a table in a web page. The user is able to click on a column header and the table is to be refreshed with the list contents sorted by that column (asc/desc).
    I would rather not re-query the DB for this list (it's pretty static and already saved in memory). So if I use the Collections.sort(myList, new Comparator() { ...} ) method, is it possible for me to pass the field/direction of the sort into the Comparator? Or, do I have to define individual Comparators for every field that the user can sort by and surround it all by an ugly switch statement?

    Honestly I think that a re-query to the DB is the best approach. Remember that any decent DB engine will cache queries so it will really only have to re-perform the sort algorithm.
    Commercial databases are very fast and almost never the source of a performance bottleneck.
    I realize this isn't the answer you want, but in my experience it is the best solution, if you really can't stand to re-query then as mentioned creating your own comparator is the way to go.

  • Sorting question over state...

    Hi there,
    Anyone know where you amend the over state / hover of an option in a sorting question ???
    Been looking in the object style manager but can't find it in there...
    Thanks in advance...

    You are talking about the partially transparent grey bar that appears when hovering over an answer in the Sequence type of questions. There is no style that can be customized AFAIK. It is not even changing with the included themes. Same is valid for the connecting lines in matching questions that are always black, color cannot be changed for them neither. It is a pity, would recommend you enter a feature request to be able to customize the color of both the hover bar and those lines.
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Lilybiri

  • Urgent array sorting question

    I've sorted an array with "Collections.sort(myArrayList)" ..that's ok..but
    in my JList words appare sorted first the uppercase after lowercase
    (i.e. A,CCC,DDDDD,aa,bbb,cc,d)......I want it sort together..
    A lot of thanks for all answer!!

    Use Collections.sort(List list, Comparator c) api.
    Look into java.util.Comparator to create your own custom comparator, for ex.
    public class StringIgnoreCaseComparator implements Comparator {
      public int compare(Object o1, Object o2) {
        String s1 = (String)o1.toLowerCase();
        String s2 = (String)o2.toLowerCase();
        return s1.compareTo(s2);
      public boolean equals(Object obj) {
    }--lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Compile error when using Collections.sort for Vector, why?

    The compiler is giving an error when trying to do this (I'm using JDK 1.5.0_09):
    Vector <String> test = new Vector <String>();
    test.add("test1");
    test.add("test2");
    test.add("test3");
    Collections.sort(test);The error being:
    The method sort(Vector<String>) is undefined for the type Collections
    Collections.sort takes List, but Vector is of type List, so this should work, correct?

    ChuckBing wrote:
    No. Vector is not a subclass of List. Use List.um.. Vector implements List

  • TreeSet vs Collection.Sort / Array.sort for Strings

    Gurus
    I am pondering weather to use TreeSet vs the Collections.sort / Array.sort for sorting Strings.
    Basically I have a list of Strings, i need to perform the following operations on these Strings
    1) Able to list Strings starting with a Prefix
    2) Able to list Strings Lexically greater than a String
    Any help would be greatly appreciated!
    Thanks a bunch

    SpaceShuttle wrote:
    Gurus
    I am pondering weather to use TreeSet vs the Collections.sort / Array.sort for sorting Strings.
    Basically I have a list of Strings, i need to perform the following operations on these Strings
    1) Able to list Strings starting with a Prefix
    2) Able to list Strings Lexically greater than a String
    Any help would be greatly appreciated!
    Thanks a bunchBig-O wise, there's no difference between sorting a list of N elements or inserting them one by one in a tree-set. Both take O(n*log(n)). But both collections are not well suited for looking up string that start with a certain substring. In that case you had better use a Patricia tree (or Radix tree).
    Good luck.

  • Compiler warning with Collections.sort() method

    Hi,
    I am sorting a Vector that contains CardTiles objects. CardTiles is a class that extends JButton and implements Comparable. The code works fine but i get the following warning after compilation.
    Note: DeckOfCards.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    After compiling with -Xlint, i get the following warning;
    DeckOfCards.java:173: warning: [unchecked] unchecked method invocation: <T>sort(java.util.List<T>) in java.util.Collections is applied to (java.util.Vector<CardTiles>)
    Collections.sort(handTwo);
    ^
    What could be the problem? Is Collections.sort() only intended for Collections of type List?
    Many thanks!

    Hi Jverd, my handTwo Vector was declared as follows;
    Vector<CardTiles> handTwo = new Vector<CardTiles>();
    The CardTiles Source code is as follows;
    import javax.swing.*;
    import java.util.*;
    public class CardTiles extends JButton implements Comparable{
         static String typeOfSort = "face";
         public static final long serialVersionUID = 24362462L;
         int i=1;
         public ImageIcon myIcon;
         public Card myCard;
         public CardTiles(ImageIcon i, Card c){
              super(i);
              myIcon = i;
              myCard = c;
         public int compareTo(Object o){
              CardTiles compare = (CardTiles)o;
              if(typeOfSort.equals("face")){
                   Integer ref1 = new Integer(this.myCard.getFaceValue());
                   Integer ref2 = new Integer(compare.myCard.getFaceValue());
                   return ref1.compareTo(ref2);
              }else{
                   if(this.myCard.getFaceValue() > 9 || compare.myCard.getFaceValue() >9){
                        if(this.myCard.getFaceValue() > 9 && compare.myCard.getFaceValue() >9){
                             String ref1 = this.myCard.getSuit().substring(0,(this.myCard.getSuit().length()-1));
                             String ref2 = compare.myCard.getSuit().substring(0,(compare.myCard.getSuit().length()-1));
                             return ref1.compareTo(ref2);
                        }else{
                             if(this.myCard.getFaceValue() > 9 || compare.myCard.getFaceValue() >9){
                                  String ref1 = this.myCard.getSuit().substring(0,(this.myCard.getSuit().length()-1));
                                  String ref2 = compare.myCard.getSuit() + Integer.toString(compare.myCard.getFaceValue());
                                  return ref1.compareTo(ref2);
                             }else{
                                  String ref1 = this.myCard.getSuit() + Integer.toString(this.myCard.getFaceValue());
                                  String ref2 = compare.myCard.getSuit().substring(0,(compare.myCard.getSuit().length()-1));
                                  return ref1.compareTo(ref2);
                   }else{
                        String ref1 = this.myCard.getSuit() + Integer.toString(this.myCard.getFaceValue());
                        String ref2 = compare.myCard.getSuit() + Integer.toString(compare.myCard.getFaceValue());
                        return ref1.compareTo(ref2);
         public String toString(){
              return ( myCard.toString() + " with fileName " + myIcon.toString());
    }What could be wrong?
    Many thanks!

  • Can someone explain simply what "collections.sort " does???

    Hi,
    i'm learning java with "teach yourself java 6 in 21 days" and i'm on day6 trying to implement interfaces and packages. what i can't understand is...
    there are two classes Storefront and Item in a package. there's another class GiftShop which imports this package. Item implements comparable(the interface) and defines the method comapreTo. Now GiftShop calls a method sort which is in Storefront which inturn calls Collection.sort passing it the linked list called catalog. as far as i understand, this collection.sort calls the compareTo method and sorts the linkedlist somehow. please explain to me how and please tell me where does this collection.sort comes in from? where does it reside basically????
    i'm confuseddddd and i really need to move on so please help help help
    package org.cadenhead.ecommerce;
    import java.util.*;
    public class Item implements Comparable {
         private String id;
         private String name;
         private double retail;
         private int quantity;
         private double price;
         Item(String idIn, String nameIn, String retailIn, String quanIn){
              id = idIn;
              name = nameIn;
              retail = Double.parseDouble(retailIn);
              quantity = Integer.parseInt(quanIn);
              if (quantity > 400)
                   price = retail * .5D;
              else if (quantity > 200)
                   price = retail * .6D;
              else
                   price = retail * .7D;
              price = Math.floor(price * 100 + .5) / 100;
         public int compareTo(Object obj) {
              Item temp = (Item)obj;
              if (this.price < temp.price)
                   return 1;
              else if (this.price > temp.price)
                   return -1;
              return 0;
         public String getId() {
              return id;
         public String getName() {
              return name;
         public double getRetail() {
              return retail;
         public double getPrice() {
              return price;
         public int getQuantity() {
              return quantity;
    package org.cadenhead.ecommerce;
    import java.util.*;
    public class Storefront {
         private LinkedList catalog = new LinkedList();
         public void addItem(String id, String name, String price, String quant) {
              Item it = new Item(id, name, price, quant);
              catalog.add(it);
         public Item getItem(int i) {
              return (Item)catalog.get(i);
         public int getSize() {
              return catalog.size();
         public void sort() {
              Collections.sort(catalog);
    import org.cadenhead.ecommerce.*;
    //import org.cadenhead.ecommerce.Item;
    public class GiftShop {
         public static void main(String[] arguments){
              //Item ti = new Item("C01", "MUG", "9.99", "150");
              Storefront store = new Storefront();
              store.addItem("C01", "MUG", "9.99", "150");
              store.addItem("C02", "LG MUG", "12.99", "82");
              store.addItem("C03", "MOUSEPAD", "10.49", "800");
              store.addItem("D01", "T SHIRT", "16.99", "90");
              for (int i = 0; i < store.getSize(); i++) {
                   Item show = (Item)store.getItem(i);
                   System.out.println("\n Item ID: " + show.getId() +
                        "\n Name: " + show.getName());
              store.sort();
              System.out.println("Catalog Size: " + store.getSize());
              for (int i = 0; i < store.getSize(); i++) {
                   Item show = (Item)store.getItem(i);
                   System.out.println("\n Item ID: " + show.getId() +
                        "\n Name: " + show.getName() +
                        "\n Retail Price: " + show.getRetail() +
                        "\n Price: " + show.getPrice() +
                        "\n Quantity: " + show.getQuantity());
    }

    Chiya wrote:
    what are code tags?When you post code, please post it between [code] and [/code] tags (you can also use the appropriate button on the message posting screen). It makes your code much easier to read and prevents accidental markup from the forum software.
    Example:import org.cadenhead.ecommerce.*;
    public class GiftShop {
         public static void main(String[] arguments){
              Storefront store = new Storefront();
              store.addItem("C01", "MUG", "9.99", "150");
              store.addItem("C02", "LG MUG", "12.99", "82");
              store.addItem("C03", "MOUSEPAD", "10.49", "800");
              store.addItem("D01", "T SHIRT", "16.99", "90");
              for (int i = 0; i < store.getSize(); i++) {
                   Item show = (Item)store.getItem(i);
                   System.out.println("\n Item ID: " + show.getId() +
                   "\n Name: " + show.getName());
              store.sort();
              System.out.println("Catalog Size: " + store.getSize());
              for (int i = 0; i < store.getSize(); i++) {
                   Item show = (Item)store.getItem(i);
                   System.out.println("\n Item ID: " + show.getId() +
                   "\n Name: " + show.getName() +
                   "\n Retail Price: " + show.getRetail() +
                   "\n Price: " + show.getPrice() +
                   "\n Quantity: " + show.getQuantity());
    } ~

  • Collection sort

    Hi every body I have a small problem in sorting .
    I am taking one collection of type string .When I am sorting I is giving me wrong result.
    Here is my code :
    List <String> caps = new ArrayList<String>();
    caps.add("Alpha");
    caps.add("Beta");
    caps.add("alpha1");
    caps.add("Delta");
    caps.add("theta");
    Collections.sort(caps);It is sorting like :
    Alpha
    Beta
    Delta
    alpha1
    theta.
    Here I can take ant type of string even upper case / lower case .
    But the lower case words are coming later .
    Please help me out.
    thanks ,
    S

    default string sorting is case sensitive. if you want case insensitive sorting, do Collections.sort(caps, String.CASE_INSENSITIVE_ORDER)

  • Collator sorting question

    Good Day!
    I have a program, witch uses Collator class object to print numbers in order.
    Collator collator = Collator.getInstance(Locale.US);
         Collections.sort(num, collator);
    for ( i = 0; i < num.size(); i++) {
    String num1 = num.get(i);
    System.out.println("num = " + num1);
    As a result I receive
    num = 1
    num = 1
    num = 10
    num = 10
    num = 100
    num = 100
    num = 101
    num = 101
    num = 102
    num = 102
    num = 2
    num = 2
    num = 20
    But it's necessary to make numbering order as 1 1 2 2 3 3 ...
    I wonder if there is any solution to make Collator class object to understand shorter String sentences as bigger than longer ones. (For an example to understand that 2 is bigger than 10, or 3 is bigger than 20...)
    Thank you for your time!
    Have a nice day!

    What you're describing is most commonly known as the natural sort order (it's also called the intuitive or alphanumeric order). [Here's|http://www.codinghorror.com/blog/archives/001018.html] a good blog post about it. There's no class in the standard libraries that does this, nor is there anything in any public library that I know of. You can find some informal Java implementations (among other languages) by following that link, but here's one I wrote. (Note that it's a Comparator, not a Collator; if you really a Collator, I have one of those too, but it's more experimental.) import java.util.Arrays;
    import java.util.Comparator;
    * <p>A comparator that emulates the "intuitive" sorting used by Windows
    * Explorer.  The rules are as follows:</p>
    * <ul><li>Any sequence of one or more digits is treated as an atomic unit, a
    * number.  When these number units are matched up, they're compared according
    * to their respective numeric values.  If they're numerically equal, but one
    * has more leading zeroes than the other, the longer sequence is considered
    * smaller.</li>
    * <li>Numbers always sort before any other kind of character.</li>
    * <li>Spaces and all punctuation characters always sort before letters.</li>
    * <li>Letters are sorted case-insensitively.</li></ul>
    * <p>Explorer's sort order for punctuation characters is not quite the same
    * as their ASCII order.  Also, some characters aren't allowed in file names,
    * so I don't know how they would be sorted.  This class just sorts them all
    * according to their ASCII values.</p>
    * <p>This comparator is only guaranteed to work with 7-bit ASCII strings.</p>
    * @author Alan Moore
    public class IntuitiveStringComparator<T extends CharSequence>
        implements Comparator<T>
      private T str1, str2;
      private int pos1, pos2, len1, len2;
      public int compare(T s1, T s2)
        str1 = s1;
        str2 = s2;
        len1 = str1.length();
        len2 = str2.length();
        pos1 = pos2 = 0;
        if (len1 == 0)
          return len2 == 0 ? 0 : -1;
        else if (len2 == 0)
          return 1;
        while (pos1 < len1 && pos2 < len2)
          char ch1 = str1.charAt(pos1);
          char ch2 = str2.charAt(pos2);
          int result = 0;
          if (Character.isDigit(ch1))
            result = Character.isDigit(ch2) ? compareNumbers() : -1;
          else if (Character.isLetter(ch1))
            result = Character.isLetter(ch2) ? compareOther(true) : 1;
          else
            result = Character.isDigit(ch2) ? 1
                   : Character.isLetter(ch2) ? -1
                   : compareOther(false);
          if (result != 0)
            return result;
        return len1 - len2;
      private int compareNumbers()
        int delta = 0;
        int zeroes1 = 0, zeroes2 = 0;
        char ch1 = (char)0, ch2 = (char)0;
        // Skip leading zeroes, but keep a count of them.
        while (pos1 < len1 && (ch1 = str1.charAt(pos1++)) == '0')
          zeroes1++;
        while (pos2 < len2 && (ch2 = str2.charAt(pos2++)) == '0')
          zeroes2++;
        // If one sequence contains more significant digits than the
        // other, it's a larger number.  In case they turn out to have
        // equal lengths, we compare digits at each position; the first
        // unequal pair determines which is the bigger number.
        while (true)
          boolean noMoreDigits1 = (ch1 == 0) || !Character.isDigit(ch1);
          boolean noMoreDigits2 = (ch2 == 0) || !Character.isDigit(ch2);
          if (noMoreDigits1 && noMoreDigits2)
            return delta != 0 ? delta : zeroes2 - zeroes1;
          else if (noMoreDigits1)
            return -1;
          else if (noMoreDigits2)
            return 1;
          else if (delta == 0 && ch1 != ch2)
            delta = ch1 - ch2;
          ch1 = pos1 < len1 ? str1.charAt(pos1++) : (char)0;
          ch2 = pos2 < len2 ? str2.charAt(pos2++) : (char)0;
      private int compareOther(boolean isLetters)
        char ch1 = str1.charAt(pos1++);
        char ch2 = str2.charAt(pos2++);
        if (ch1 == ch2)
          return 0;
        if (isLetters)
          ch1 = Character.toUpperCase(ch1);
          ch2 = Character.toUpperCase(ch2);
          if (ch1 != ch2)
            ch1 = Character.toLowerCase(ch1);
            ch2 = Character.toLowerCase(ch2);
        return ch1 - ch2;
      public static void main(String[] args)
        String[] list =
          "foo 03",
          "foo 00003",
          "foo 5",
          "foo 003",
          "foo~03",
          "foo 10far",
          "foo 10boo",
          "foo 10",
          "foo!03"
        Arrays.sort(list, new IntuitiveStringComparator<String>());
        for (String s : list)
          System.out.println(s);
    }

  • How can i use Collections.sort

    hi! i hope someone can help me. Im trying to sort a list that has Strings on it...
    list.add("rmjBBrmj");
    list.add("rmjAArmj");
    list.add("rmjDDrmj");
    list.add("rmjCCrmj");
    How can i use the "Collections.sort" if i wanted it sorted by the capital letters, like rmjAArmj,rmjBBrmj,rmjCCrmj,rmjDDrmj. Thank you very much for your help.

    You override the "natural" sort order by suppling a Comparitor which orders any pair of strings as you see fit, e.g. convert them to upper case before comparing.

  • Sorting questions; albums together within genres?

    Hi!
    I have some questions concerning the way iTunes sorts my Library.
    I'd like it to sort the classical section on composer, instead of artist. My library is sorted on Genre primary, and perhaps it's impossible to sort only one genre on Genre-Composer-Album . If so, I'll accept that.
    However, this next one should be possible in some way:
    How do I get iTunes to keep tha different albums sorted together in Soundtrack genre? For instance, the Buffy Ultimate Album keeps getting mixed up with Lock Stock and Two smoking barrells album, despite that I've checked "part of a collection" and entered specific CD track numbers for every one of the tracks. I even tried entering "Buffy ultimate soundtrack" into the Grouping field. What does that one do if not keep them together?
    Help please...

    How do I get iTunes to keep tha different albums sorted together in Soundtrack genre?
    I would really like to know the same thing!!!! I have a lot of movies and B'Way soundtracks that I would like to peruse by album title. It seems the ipod only lets me browse by song and I agree, they all get jumbled together.
    I am now in the process of dragging them all into a soundtracks playlist, which is a little better because at least the songs stay in the right order. I would love to be able to drag the album title into the playlist and then go onto the next song list screen from there.
    I am going to suggest it on the feedback page.
    I hope someone can shed some light on what can be done about this.

  • A collections of questions on scheduling information

    Hello, I am doing some research on QoS management, and I need much scheduling information. So I got some questions.
    1 Based on the oracle scheduler, I want to design my own scheduler(non-preempt). That is, once a job is finished, the scheduler need to schedule new jobs based on some job information. So how can i design such a scheduler? I think it should be a job in the database, but it is neither periodic nor event-based.
    2 Each time my scheduler runs, it probably schedule a same job to run. If the former instance of this job has not completed, the new instance will be skipped. How can I disable the former instance and let the new instance run?
    3 I will configure a periodic job which will collect all of the statistic data at the beginning of each period. How can I read the duration time of each job which has been completed? I know I can read the duration time from ALL_SCHEDULER_JOB_RUN_DETAILS,but the accuracy of the duration time in that view is only second. I need better accuracy. Another problem is, if a job has completed several instances in the last period, how can i differentiate them from each other. Because all of the instance number is 1.
    4 And also, I need to know how much CPU time all of the jobs in the last period have consumed. How can I know the cpu time of each instance of each job?(not only the jobs which have completed but also those jobs which are running.) (because I need add them together and write some algorithm to control it not exceed 80% of the period.)
    I am sorry to put so many troublesome questions together. Hope somebody can give me some guidance. Thanks a lot.

    Hi,
    I'll try to answer some of these questions briefly.
    1 Based on the oracle scheduler, I want to design my
    own scheduler(non-preempt). That is, once a job is
    finished, the scheduler need to schedule new jobs
    based on some job information. So how can i design
    such a scheduler? I think it should be a job in the
    database, but it is neither periodic nor
    event-based.The design of a new Scheduler is not something I can really advise on. Perhaps you could have it based on a master process which is a Scheduler job that runs frequently (once every minute or so).
    2 Each time my scheduler runs, it probably schedule a
    same job to run. If the former instance of this job
    has not completed, the new instance will be skipped.
    How can I disable the former instance and let the new
    instance run? The Scheduler does not allow multiple instances of the same job to run. If you want multiple instances of your action to run you need to create a scheduler program and then you can have multiple jobs pointing to that program. Those jobs can happily run in parallel
    3 I will configure a periodic job which will collect
    all of the statistic data at the beginning of each
    period. How can I read the duration time of each job
    which has been completed? I know I can read the
    duration time from ALL_SCHEDULER_JOB_RUN_DETAILS,but
    the accuracy of the duration time in that view is
    only second. I need better accuracy. Another problem
    is, if a job has completed several instances in the
    last period, how can i differentiate them from each
    other. Because all of the instance number is 1.The jobs will have different requested_start_dates . To gain better accuracy you can use log_date-actual_start_date from the ALL_SCHEDULER_JOB_RUN_DETAILS view.
    4 And also, I need to know how much CPU time all of
    the jobs in the last period have consumed. How can I
    know the cpu time of each instance of each job?(not
    only the jobs which have completed but also those
    jobs which are running.) (because I need add them
    together and write some algorithm to control it not
    exceed 80% of the period.)You can do this by querying both ALL_SCHEDULER_JOB_RUN_DETAILS and ALL_SCHEDULER_RUNNING_JOBS .
    Hope this helps,
    Ravi.

Maybe you are looking for

  • Losing objects when producing a pdf

    CS5, Mac, 10.5.8 I have a page with 5 photos and type, grayscale photos and spot color stroke around the photos. Inverse rounded photos. When I produce any type pdf with bevel and emboss added to the photos they disappear in the pdf. In InDesign tran

  • 2 Init with different selection

    Hi All, I want to run 2 inits on a single data source with different selections for that , after running the first init do I have to remove the init from the first package and then run the second package? Thanks. Tina

  • HTTP session sharing

    Hi, We have a need for session sharing among the different JVMs and have been trying the application cluster functionality with zero luck. Now we are thinking of looking into coherence because by reading the documentation we came to know this is some

  • Ask the Experts Session on AJAX Support in the Java Platform -- June 19-23

    Got a question about AJAX support in the Java Platform? Post it on the Ask the Experts page (http://java.sun.com/developer/community/askxprt/) during the week of June 19 and get answers from Sun experts Greg Murray, Mark Basler, and Carla Mott.

  • Regenerating Thumbnails?

    Can anyone help? I was capturing a video in HD. During the generation of the clip thumbnails, iMovie crashed. When I relaunched, the video I captured was there, but there were no thumbnails. All I see in the clip view is a grey filmstrip, but when i