Stop me re-inventing the wheel

I have an application to build that does the following.
1. Receives a request for data.
2. Passes the request to other sources.
3. Aggregates the data from all the sources.
4. Returns the aggregated data.
If there are 10 sources and each one takes 10 seconds to return the data and the sources are hit sequentially then it is going to take 100 seconds. However, if I start 10 threads then it will take 10 seconds.
Is there a pattern for aggregating results like this? And even better a worked example in Java ;)
Thanks for your advice.

if you are using java 1.5, then there is a class to
synchronize the work of multiple threads called a
cyclic barrier.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/conc
urrent/CyclicBarrier.htmlA lot, if not all of those concurrent classes are available for 1.4 also. Search for 'Doug Lea Concurrent' on Google.

Similar Messages

  • What does it take to find a simple ringtone to load onto my phone without re-inventing the wheel?

    what does it take to find a simple ringtone to load onto my phone without re-inventing the wheel?

    you could use a free ringtone app or
    RINGTONE
    This how to make ring tones for your iPhone:
    Choose the desired song from you library
    Do a secondary click on your song if you are using a MAC (right click for PC)
    Click "Get Info"
    Go to Options tab
    Set Start Time and Stop Time, some iOS only allow for a 30 sec duration for ringtones, then click OK
    Do secondary click (right click for PC) to your selected song
    Click "Create AAC Version", new song from your selected will added to your library (short one)
    Do secondary click (right click for PC) to your short one (new song)
    Click "Show in Finder"
    Rename file *.m4a to *.m4r, click "use *.m4r"
    Drag the file to library, for the first time it would automatically add your library with new folder "Tones" under Apps folder
    Open the ring tones in the Tones folder of your library than drag it to your iPhone and your ringtone also would be automatically added "Tones" folder.
    Last but not least, set the ring tone in your iPhone under the "Setting-Sound"
    For information on how to make ringtones read http://www.ehow.com/how_2160460_custom-iphone-ringtones-free.html
    Or
    http://www.demogeek.com/2009/07/31/how-to-add-custom-ringtones-to-your-iphone/

  • Trying not to re-invent the wheel...

    Howdy, all;
    I'm sure that some of the tasks in my current project have been done by others. Are there any code repositories out there? I'm not above paying for useful code...
    Specifically, I'm trying to convert a string such as "8+(2+2)" into the string "12". I'm using a streamTokenizer and iterating through, and then nesting when hitting parens. It's a lot of work and I'm just wondering if someone hasn't done all this before...
    So, any repositories out there?
    TIA

    Thank you both! This has pointed me in the direction
    of the resources I needed/wanted.
    BTW, beanshell looked like more, much moree, than I wa
    slooking for, I'm pursuing jbcParser instead.
    Thanks againMore than you were looking for? The following code:import bsh.Interpreter;
    public class BeanShellExample {
         public static void main(String[] args) {
              try {
                   Interpreter bsi = new Interpreter();
                   System.out.println(bsi.eval(args[0]));
              catch (bsh.EvalError ee) {
                   System.out.println("Eval Error: " + ee.toString());
    } produced the following output:
    $ java -classpath ".;bsh-2.0b2.jar" BeanShellExample "8+(2+2)"
    12I am not sure how much easier it could get!
    Good Luck
    Lee

  • Managing shared assets? (Re-inventing the wheel)

    My company has been using Eloqua for quite some time. When I joined, I found a long list of shared assets -- some dating back to the Eisenhower administration.
    During my Eloqua University training, I've been encouraged to "share" assets with my team whenever possible. However, I'm not entirely clear on how to best take advantage of useful assets that a long-departed co-worker may have created.
    For example, let's say that I created a shared filter that gives me a list of all people in the US who would gladly trade a cow for a sack of Magic Beans.
    I save it as a shared filter (and maybe or maybe not include the optional description)
    Now, assume that a co-worker in another department (perhaps in another country, who probably doesn't know me) needs to find a list of customers who are interested in Magic Beans.
    Other than wading through the hundreds of shared filters that have accumulated in the system over the years, is there a "Smart" way of finding that filter (and, by extension, any useful shared asset?)
    I am eager to share my new assets -- but even more eager to leverage what the more-experienced Eloquans have shared.
    Thanks!!

    I'm an Eloqua newbie -- in my "Fundamentals" classes, the instructors advised me that the "Descriptions" fields were ignored by the Eloqua search bots (which seemed really strange).  The question arose from my instructors urging us to "share, share, share" our assets -- but not really providing any assistance to co-workers who might benefit from those shares. (Unless you know what your co-worker wants and you tell them about it, they probably won't find your shared work.)
    I stumbled across the EloquaBulkAPI document, though. When I get a bit more comfortable with the Eloqua GUI, I'll have to dig-in and play with it. 
    (Are there other Eloqua APIs available?) 

  • XML Reader - why re-invent the wheel

    Does anyone want to post the code to a good XML Reader that they currently have in use?

    Here is some very simple code that reads all of the nodes in an XML doc. I apologize to the writer of this code, I can't remember where I got it and what his/her name is. If someone recognizes it, please pipe up. Oh yeah, and I can't remember what needed to be referenced so I included a bunch of stuff.
    anywho:
    import org.w3c.dom.*;
    import org.xml.sax.*;
    import javax.xml.parsers.*;
    import java.util.*;
    import java.io.*;
    public class LoadXMLdoc {
      private Document document;
      public LoadXMLdoc() {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        try {
          DocumentBuilder builder = factory.newDocumentBuilder();
          document = builder.parse( new File(yourDocumentPathAsStringHere) );
          Element root = document.getDocumentElement();
          String rootElement = (root.getTagName());
          root.normalize();
          System.out.println(rootElement);
          NodeList children = root.getChildNodes();
          System.out.println("It has "+ children.getLength() + " child nodes\n");
          for (int i=0;i<children.getLength();i++) {
            System.out.println(children.item(i).getNodeName());
          System.out.println("I'm done");
            } catch (SAXParseException spe) {
               // Error generated by the parser
               System.out.println("\n** Parsing error"
                  + ", line " + spe.getLineNumber()
                  + ", uri " + spe.getSystemId());
               System.out.println("   " + spe.getMessage() );
               // Use the contained exception, if any
               Exception  x = spe;
               if (spe.getException() != null)
                   x = spe.getException();
               x.printStackTrace();
            } catch (SAXException sxe) {
               // Error generated during parsing)
               Exception  x = sxe;
               if (sxe.getException() != null)
                   x = sxe.getException();
               x.printStackTrace();
            } catch (ParserConfigurationException pce) {
                // Parser with specified options can't be built
                pce.printStackTrace();
            } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
    }Hope that helps you. It helped me.
    Good Luck.
    Ben

  • I have a brand new macbook pro that i was doing a data transfer from an old macbook, it got stopped/cable pulled out, now have spinning wheel of death that wont stop, how do i reboot/stop the wheel of death and start again?

    i have a brand new macbook pro that i was doing a data transfer via firewire from an old macbook, it got stopped/cable pulled out, now have spinning wheel of death that wont stop, how do i reboot/stop the wheel of death and start again? (this time il use time machine transfer)

    Just power off the machine(s). Shut them down. Migration Assistant gets 'stuck' sometimes - best way to migrate really isn't over Firewire, though it will certainly work, but with both machines hardwired via Ethernet to the same router. You can use a TM backup, too, of course, provided that it's recent. Which is the best? Your choice. I've done it both ways and have a preference for MA, but TM restore can be a bit faster and less quarrelsome.
    Clinton

  • My iphone4 will not connect to my network.  My iPad and my wife's iPad and iphone4 all connect to my network.  I have tried the solutions in Apple trouble shooting site. Still no connection.The "wheel" turns for 2 sec. then stops w/o connecting?

    My iphone4 will not connect to my network.  My iPad and my wife's iPad and iphone4 all connect to my network.  I have tried the solutions in Apple trouble shooting site. I even tried the freezer option. Still no connection.The "wheel" turns for 2 secOne then stops without connecting.  Anyine have a solution to this issue?

    I have an AT&T contracted iphone 5. Cannot send mms to anyone but other iPhone users. If you search the Internet, you'll see that the problem is everywhere...both the carriers and Apple are actling like the problem belongs to the other, or feigning any knowledge (which is kind of funny since the no MMS thing was in an ios6 beta that was released awhile ago, so I KNOW apple knows about it). No, I'm not running a beta (obviously, I just got my iphone 5).  Awesome. Have a great camera on this thing, but cannot send OR receive MMS from anyone other than other iphone users. Gotta love it.

  • HT4993 My iPhone 5 keeps trying to download something. The wheel by the wifi symbol is continually spinning. What can I do to stop it? I have shut down all apps.

    The wheel that shows your downloading something on my iPhone 5 will not stop spinning. What can I do to stop it? I have shut down all apps, restarted my phone as well I have pushed the power button & home button at the same time. Still no luck.

    If restart and reset don't solve this problem then something must be being started when your iPhone starts up that cannot complete.
    You might consider restoring your iPhone to Factory via iTunes.

  • After ejecting SD card by pulling it to trash in iphoto, the wheel is spinning.  How do I get it to stop?  What happens if I force quit it?

    After ejecting SD card by pulling it to trash in iphoto, the wheel is spinning.  How do I get it to stop?  What happens if I force quit?

    After ejecting SD card by pulling it to trash in iphoto, the wheel is spinning.  How do I get it to stop?  What happens if I force quit?

  • My Photos app stopped working last week.  It opens to the welcome splash screen, but when i select get started, the wheel starts spinning and that's all that happens.  When I try to close it, it says it's creating a library, but never ends.

    I have been using Photos since the update.  I had no problems until last week when it stopped working.  Despite the fact that I've been using it, it opens to the welcome splash screen with the "Get Started" button.  When I click it, the wheel starts spinning and that's all that happens until eventually force quit it using the apple menu.  Can anyone help?

    OK, so apparently you have the MBW connected via the software equivelent of a crossover cable- ethernet frames but no routing.  Not sure what negative impact that has or doesn;t have. Certainly its not how the drive was intended to work - it would be far easier to just have a USB connection for that.
    WD software in general has a very bad history. Note that some drives have been lost entirely due to incompatability with Mavericks - read the tips section here for mroe details, btu i would NOT use it.
    I cant help you with WD software. But the first task is to access the drive and make sure you can communicate with it. I would go to the main drive to do that. From there you should be abke to remove the partition for the backup, and begin over with something less troublesome - such as Carbon Copy Cloner, Time MAchine ( i dont use it and did nt much like it) or , my preferred method, good old unix rsync.
    In any event, your prpoblem is one of authorization. So first see if the drive is responding in general ( try to access it the normal way), then move to that particular volume.
    Grant

  • Mail crashes after it appears to go to the server as the wheel stops abruptly and the mail crashes

    I am not able to rebuild the mail boxes unless I turn off my WiFi, which I have done.
    I open Mail, the wheel starts to turn about two or three turns it then stops and the Mail program crashes with a report going to Apple.
    I am considering going back to Leopard.
    Funny thing is that it worked just fine for about 2 weeks with no hitch. Then it started crashing with the Mail app.
    LarryB

    I have having trouble with Mail also....have no problem with my phone or iPad, just my MBA.  Very frustrating.  spins and spins...try to quit, and have to force quit.

  • 2012 MB Pro 13" came with Lion - nearly new, second owner. Stopped responding yesterday in the middle of work. Forced quit, booted up single user, ran fsck -fy, mount -us /, reboot. Stuck on grey apple screen with spinning wheel forever now. Please help

    2012 MB Pro 13" came with Lion - nearly new, second owner. Stopped responding yesterday in the middle of work. Forced quit; reboot stuck on grey apple screen. Booted as single user; ran fsck -fy; mount -us /; reboot. Still stuck on grey apple screen with spinning wheel.
    Any advice please?
    Thanks

    Run through this list of fixes, your solution is there
    Step by Step to fix your Mac

  • In mail, how do I get the wheel to stop going around and around beside the "sent" on the side of the screen?d

    I am having trouble getting rid of the annoying broken up circle going around and around on the right side of "sent" in the left panel.  I went into mail preferences and retyped the passwords for the server, but it still keeps going.  Also tried a repeat sending of the message.  Now the messages keeps showing up in the Outbox with the wheel still turning.  Is there anything more to do or is this a matter for my server company?

    I just checked with my service provider to make sure that my passwords are the same for them as well as my mail for this account.  Was able to send an email from online, but not mail on my iMac even though when I edited my accounts in Mail preferences to be sure that the password matches.  This is driving me crazy.  Please help.

  • How to stop the wheel of death on iPhoto?

    how to get rid of the wheel of death on iphoto

    Back up your iPhoto library, depress the option and command keys, launch iPhoto and rebuild your library
    LN

  • My imac wont start up the wheel just spins

    my screen went high contrast. i could not force quit so i powered off.  when i powered on the wheel just spins. this has been going on for an hour.

    Take each of these steps that you haven't already tried. Stop when the problem is resolved.
    Step 1
    The first step in dealing with a boot failure is to secure your data. If you want to preserve the contents of the startup drive, and you don't already have at least one current backup, you must try to back up now, before you do anything else. It may or may not be possible. If you don't care about the data that has changed since your last backup, you can skip this step.   
    There are several ways to back up a Mac that is unable to boot. You need an external hard drive to hold the backup data.
         a. Boot into Recovery by holding down the key combination command-R at the startup chime, or from a local Time Machine backup volume (option key at startup.) Release the keys when you see a gray screen with a spinning dial. When the OS X Utilities screen appears, launch Disk Utility and follow the instructions in this support article, under “Instructions for backing up to an external hard disk via Disk Utility.”
    b. If you have access to a working Mac, and both it and the non-working Mac have FireWire or Thunderbolt ports, boot the non-working Mac in target disk mode by holding down the key combination command-T at the startup chime. Connect the two Macs with a FireWire or Thunderbolt cable. The internal drive of the machine running in target mode will mount as an external drive on the other machine. Copy the data to another drive. This technique won't work with USB, Ethernet, Wi-Fi, or Bluetooth.
    c. If the internal drive of the non-working Mac is user-replaceable, remove it and mount it in an external enclosure or drive dock. Use another Mac to copy the data.
    Step 2
    Press and hold the power button until the power shuts off. Disconnect all wired peripherals except those needed to boot, and remove all aftermarket expansion cards. Use a different keyboard and/or mouse, if those devices are wired. If you can boot now, one of the devices you disconnected, or a combination of them, is causing the problem. Finding out which one is a process of elimination.
    If you've booted from an external storage device, make sure that your internal boot volume is selected in the Startup Disk pane of System Preferences.
    Step 3
    Boot in safe mode. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Post for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    When you boot in safe mode, it's normal to see a dark gray progress bar on a light gray background. If the progress bar gets stuck for more than a few minutes, or if the system shuts down automatically while the progress bar is displayed, your boot volume is damaged and the drive is probably malfunctioning. In that case, go to step 5.
    If you can boot and log in now, empty the Trash, and then open the Finder Info window on your boot volume ("Macintosh HD," unless you gave it a different name.) Check that you have at least 9 GB of available space, as shown in the window. If you don't, copy as many files as necessary to another volume (not another folder on the same volume) and delete the originals. Deletion isn't complete until you empty the Trash again. Do this until the available space is more than 9 GB. Then reboot as usual (i.e., not in safe mode.)
    If the boot process hangs again, the problem is likely caused by a third-party system modification that you installed. Post for further instructions.
    Step 4
    Sometimes a boot failure can be resolved by resetting the NVRAM.
    Step 5
    Launch Disk Utility in Recovery mode (see Step 1.) Select your startup volume, then run Repair Disk. If any problems are found, repeat until clear. If Disk Utility reports that the volume can't be repaired, the drive has malfunctioned and should be replaced. You might choose to tolerate one such malfunction in the life of the drive. In that case, erase the volume and restore from a backup. If the same thing ever happens again, replace the drive immediately.
    This is one of the rare situations in which you should also run Repair Permissions, ignoring the false warnings it may produce. Look for the line "Permissions repair complete" at the end of the output. Then reboot as usual.
    Step 6
    Boot into Recovery again. When the OS X Utilities screen appears, follow the prompts to reinstall the OS. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
    Note: You need an always-on Ethernet or Wi-Fi connection to the Internet to use Recovery. It won’t work with USB or PPPoE modems, or with proxy servers, or with networks that require a certificate for authentication.
    Step 7
    Repeat step 6, but this time erase the boot volume in Disk Utility before installing. The system should automatically reboot into the Setup Assistant. Follow the prompts to transfer your data from a backup.
    Step 8
    A dead logic-board battery in a Mac Pro can cause a gray screen at boot. Typically the boot failure will be preceded by loss of the startup disk and system clock settings. See the user manual for replacement instructions.
    Step 9
    If you get this far, you're probably dealing with a hardware fault. Make a "Genius" appointment at an Apple Store to have the machine tested.

Maybe you are looking for

  • How to get date range of Current week

    Hi Gurus, I need to create report of current(this) week manual bills created by one user. I have date Field called CREAT_DATE.Based on this date column i need to create report. Could anybody help to get this query. Example: select ..... from .... whe

  • Turns on then off

    My iPod was discharged. So I charged it using a usb port. So when i connected it, it had the non animated battery with the lightening bolt. So i waited like the guide said to. Then the iPod turned on like the guide said but then it turned off. And no

  • Sockt connection

    Hi, I want to create a socket connection. When i run the server and then connect it from blackberry simulator of jde it gives these errors on server side: Exception in thread "main" java.lang.ExceptionInInitializerError at com.rim.samples.server.sock

  • Return billing type in Is-Retail

    hi For POS sales we are using billing document "FP".but at the time of returns also system using Billing doc type same "FP".but client requiement is separate billing type for returns. so it is possible? if possible where i have to setting? Rajendra

  • Tells me my password for wifi is incorrect

    just go a new router (verizon) and my ipad and other verizon phone connected to wifi with no problem.  my iphone4 (ATT) keeps telling me i have an incorrect password (wep) but i know it is correct.