Playing with threads, fun, but I need questions answered

Ok so I am learning multi-threading. My implementation is to use a runnable and Executor interface. The run() method can not be overloaded so my question is, how can I run 2 threads executing different code?

Well as I write, too much information for me. Sorry, but I am not a developer, not a Swing programmer, not anything and on the level of noob tinkering with stuff because I want to learn it and it has not been taught to me yet. What is proposed is simply beyond what I am doing right now and I think mostly stabbing in dark to jazz up a program beyond my programming capabilities atm. So I thought I could come here and get the buzz on working through my multithread tinkering.
Anyway, I have tried using sleep(), tried alternating my two lazy threads but I think I am doomed to have to put this off till semester is over. I can thread well now on a basic level but when I run the following code in 2 threads simultaneously, they don't share, one hogs and tells the other to shut up:
public void run()
        try
                Thread.sleep(1000);
                System.out.println(toString());
            catch(Exception haha)
        for (seconds = 0; seconds < 5; seconds++)
            System.out.println(toString());
public void run()
        int count = 2;
        do
            int nextPoisson = linkedList.Poisson(expectedValue);
            for ( int i = 0; i < nextPoisson; i++)
                linkedList.enQueue(nextPoisson + "", 0);  // enQueue the node
                count--;
            try
                Thread.sleep(2000);
            catch(Exception haha)
            linkedList.setTime();        // set the wait time
        while(count > 0);
    }Meh been a blast with this and even if it doesnt work like I want still nice to expose myself.

Similar Messages

  • My new Tecra A11-11K comes with w7-64bits, but I need w7-32bits

    My new Tecra A11-11K comes with w7-64bits, but I need w7-32bits due to an old program I use for professional purpose.
    I've bougth a w7 license with 32 and 64b.
    My question is how to install w7-32 over 64. I think it's as easy as plug the CD and go. yes?
    But I'd like to preserve Toshiba Utilities other programs that come with the w7-64 pre-installed. Where can I get them? From Toshiba download center?
    And which of them I need? All?
    Thank you for your help.

    Hello
    The Toshiba tools like Value Added Package, Eco Utility, etc. can be downloaded on official Toshiba website:
    http://eu.computers.toshiba-europe.com/innovation/download_drivers_bios.jsp
    Some preinstalled tools like Nero only available on preinstalled Windows version and cant be downloaded but there is a small freeware version of Nero that can be downloaded from Ahead directly:
    http://www.nero.com

  • Somehow, I created 2 Appe ID's...1 from home and 1 from work.  I purchased additional space on iCloud with one ID, but I need to transfer it to the other.

    Somehow, I created 2 Appe ID's...1 from home and 1 from work.  I purchased additional space on iCloud with one ID, but I need to transfer it to the other.

    Having read some other posts I think I have answered my question. If I was somehow able to terminate my old (unwanted) account and Apple ID I would no longer be able to access the material I bought with that ID-  so I'm stuck. I have to learn how to manage that situation.
    This is unfortunate for Apple consumers. Life is complicated for families these days and this "rule" although it is in place to prevent cheating and fraud makes things unnnecessarily difficult for me and my family as in my niaevity (sic) with the online world I bumbled into this situation. Not everyone is out to rip off Apple - one of the worlds richest corporations- or the entertainers who market their work through iTunes.I would just like to be able to enjoy the entertainment I pay for where and when I like to on whichever computer is available to me. And I'm not terribly computer literate.   
    It would have been nice to have had the opportunity to speak just once to a real person in the employ of Apple to explain my situation to them.

  • Hi, i'ld like to play with AOE III, but CD is recognized as empty. Is someone able to help me? Thanks

    Hi, i'ld like to play with AOE III, but CD is recognized as empty. Is someone able to help me? Thanks

    Can you make phone calls on the phone that won't activate?   Is it only iMessage and Facetime that isn't working?   What about data - can you access the internet?
    Your last statement didn't make much sense to me:  " I still can have the apps working but only from an email"
    Pls explain that clearly.

  • "HELP" NEED QUESTION ANSWERED, ":PLEASE":

    "HELP" NEED QUESTION ANSWERED, ":PLEASE": OH DEAR GOD SEND SOMEONE TO ME WITH THE ANSWER.

    You need patience. This isn't instant answers, you may have to wait for an answer. Your questions are here - locking this thread.
    https://support.mozilla.com/en-US/questions/859594 <br />
    https://support.mozilla.com/en-US/questions/859665

  • Lwill Buy skype number but i need some answers

    lwill Buy skype number but i need some answers
    I will buy denemark number it costs 18$ for 3 months i want to know if i will have any credit to call from it or i will have to buy credit
    Second . I want to know if i called a mobile number in any country like egypt is my skype denemark number will appear
    Third does true call show that it skype number or not

    Hi, Momo223, and welcome to the Community,
    momo223 wrote:
    lwill Buy skype number but i need some answers
    I will buy denemark number it costs 18$ for 3 months i want to know if i will have any credit to call from it or i will have to buy credit
    A Skype Number is a different subscription from purchasing credit; you would have to check on the offerings available if credit is "bundled" with a Skype Number purchase or not.  I do not believe it is.  Credit is credit; there is no "discounted" rate.  Check the Skype subscription website pages to see if purchasing a subscription could discount the cost of a Skype Number.
    momo223 wrote:
    lwill Buy skype number but i need some answers
    Second . I want to know if i called a mobile number in any country like egypt is my skype denemark number will appear
    Third does true call show that it skype number or not
    Your second two questions are related to Caller ID.  More details about how this works can be found in this library of FAQ articles:  https://support.skype.com/en/category/CALLER_IDENTIFICATION/
    Caller ID is tricky; sometimes it works and sometimes the data does not get transmitted as the call is routed from Skype to one or more carriers before the call reaches its destination.  For best success, be sure your Skype Number is set in your on-line account details as your Caller ID.  What ultimately appears for the ID on the call recipient's side ultimately depends upon the carrier.  For more details about this, check posts by Community contributor WD9EWK.
    Since a Skype Number is a fixed line number, there is no indication that the number is a "Skype Number" or a "fixed line" number.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Hi guys I need to restrict access to the settings with a passcode but also need passcode for the screen lock due to MS Exchange. Can these codes be different?

    We are introducing iPhonse into the business but have a question regarding security. We need to restrict user access to the settings on the iphone  probably via a passcode. We also need the user to have access to their emails (which when using exchange enforces a passcode). Is this the same passcode that is used for both by default? Because if it is then by allowing the user access to their emails they would by default have access to the code that allows them to change the settings of the iphone?
    Does anyone have any knowledge of this or how I can achieve something similar.
    Thanks
    Paul

    Hi,
    Thanks for your reply
    Could you by any chance provide a few simple steps on how to do this as i not too sure how you differentiate creating a passcode for restrictions and creating a passcode for lock screen?
    Kind Regards,
    Paul

  • My question might sound funny!!!,but I need an answer

    I'am new to java,I would like to know that java doesn't support multiple inheritance,and instead it has a feature of interfaces....which again has methods which don't have thier implementation and constant variables.
    Then when I implement this interface in my classes,I have to implement all the methods of the interface.
    What is the role played by the interface here...how it replaces the place of multiple inheritance.

    First detremine what you need a class to do.
    Define an interface which defines the methods which need to be accessable to other packages.
    Create a class which implements those methods. It may also have other methods but these are for 'internal' use.
    Interfaces help you to define a contract that other packages can use.
    In my case, I have mutliple implementation of the same interface which I can change at will (at run time in fact) without change the calling code because the caller only uses refers to the interface.
    Interfaces are much more useful which you are writing non-trival sized programs, especially if you are sharing code with other developers.

  • Sales order with MRP run but no need of sales order stock while PGI

    Dear Gurus,
    We have scenario in company that we want to run MRP for sales order & generate requirements. But while doing post goods issue for same sales order, sales order stock need not be present.
    Please tell which planning strategy, strategy group or else should be used here.
    Thanks in Advance !!
    Thanks,
    Vishwas 

    Hi,
    Please configure in the following manner..
    create a strategy group say Z9..in this maintain main strategy as 20  and alternate strategy as 10... Now assign this strategy group to material in material master in MRP3 View..
    Now create sales order say A and run MRP with MD50..after completion of production you will get Sales order stock.. now convert this sales order stock unrestricted use stock..
    Now before you are doing PGI for sales order A... go to sales order change VA02 and change the requirement type to KSL from KE and then system will all you to do PGI with unrestricted use stock...
    Thanks
    Kumar

  • This may seem like a silly question but I need it answered plz

    This may seem like a silly question but I am pretty new to
    dreamweaver but I am learning it. The question I have is this. When
    your typing a paragraph and hit enter to make the next line of text
    it goes down 2 spaces. Sometimes I don't want those two spaces. I
    want no space between the two sentences. How do you put one
    sentence below another with no spaces? Thanks in advance. I seems
    to have figured out all the other basic stuff except for this one
    thing lol. Thanks for the help in advance.

    >>>This may seem like a silly question
    There are no silly questions, only stupid answers.
    Alan sorted you, don't be afraid of asking questions.
    Kind Regards
    Paul Dell
    Photography and Web
    www.dellimages.com
    Blog
    www.paul-dell.com
    "ancientone567" <[email protected]> wrote in
    message
    news:fq4is3$mln$[email protected]..
    > This may seem like a silly question but I am pretty new
    to dreamweaver but
    > I am
    > learning it. The question I have is this. When your
    typing a paragraph and
    > hit
    > enter to make the next line of text it goes down 2
    spaces. Sometimes I
    > don't
    > want those two spaces. I want no space between the two
    sentences. How do
    > you
    > put one sentence below another with no spaces? Thanks in
    advance. I seems
    > to
    > have figured out all the other basic stuff except for
    this one thing lol.
    > Thanks for the help in advance.
    >

  • Downloaded movies from Itunes plays with no sound, but YouTube, MobileMe, Imovies, all play correctly?

    I have tried this on two TVs with the same effect, no sound.  The HDMI connection works for everything else, Itunes music, etc.

    Could this be related to that AC3 no ACC audio track issue discussed here...
    http://discussions.apple.com/thread.jspa?threadID=1796248&tstart=15
    I have yet to upgrade my TV to the latest due to the 5.1 audio issue....
    Do I need to worry about ALL my other files that are in AAC audio?

  • Where can I download just Lion 10.7X. Computer not compatible with mountain Lion but still need to upgrade.

    Note: I'm on Snow Lepard... I Just tried upgrading to Mountain Lion but it states that it's uncompadable with my computer. So I want to upgrade to just Lion )SX 10.7 YET i can not find anywhere to buy this. It's not in the app store. I can't find any link to older versions of the OS. Can someone please help?

    UPDATE: I am going on day 3 and have yet to receive my code! Seriosuly... a NUMBER that they send via email. DAY 3??? Because it take this long to "process"??? You have got to be "F'ING" Kindding me! Customer service is key and Apple USE...USE!.. to be king. I actually waited on the phone for 25 minute just to be told I had to wait for GOD KNOWS WHEN (ie. maybe 3 days) for the order to be processed.
    As an investor ($90k deep)) i think i will be droppign about half+ my positions tomorrow. It's always good to test those you invest ;-)

  • I am trying to change my NAT type from strict to Open so i can play with my friends but i dont know how to do it on my Apple Airport. Help please?!?!

    .

    Unfortunately, the AirPorts are not listed as Xbox Live-compatible routers ... so there is no guarantee doing this will get Open NAT status for Xbox Live!
    The following web blog does a great job explaining the NAT issues with Xbox Live! Basically what it comes down to is that although you can get an Internet connection for the Xbox with the AirPorts, you may not get the necessary NAT setting (Moderate or Open) for the Xbox Live! on-line game that you want to play. As such, you basically have two options: 1) Create a DMZ (Apple calls this a Default Host) for the XBox or 2) Configure the AirPort for Port mapping to open the required ports to allow Xbox Live! access ... or 3) Use a compatible router.
    Option 1 - Create a DMZ
    AirPort Utility > Select the AirPort > Manual Setup > Internet > NAT
    Enable default host at: <Enter the IP Address for the XBox>
    Option 2 - Configure Port Mapping
    The following ports must be available for Xbox Live to operate correctly:
    UDP 88
    UDP 3074
    TCP 3074
    To setup port mapping on an 802.11n AirPort use the AirPort Utility, in Manual Setup, to make these settings:
    1. Reserve a DHCP-provided IP address for the Xbox 360.
    AirPort Utility > Select the AirPort > Manual Setup > Internet > DHCP tab
    Click the "+" (Add) button to enter DHCP Reservations.
    Description: <enter the desired description of the host device>
    Reserve address by: MAC Address
    Click Continue.
    MAC Address: <Enter the MAC hardware address of the Xbox or the MAC address of the wireless depending on how you connect the XBox to the network.>
    IPv4 Address: <enter the desired Private IP address>
    Click Done.
    2. Setup Port Mapping on the AirPort.
    AirPort Utility > Select the AirPort > Manual Setup > Internet > NAT > Configure Port Mappings
    Click the "+" (Add) button
    Service: <choose the appropriate service from the Service pop-up menu>
    Public UDP Port(s): 88, 3074
    Public TCP Port(s): 3074
    Private IP Address: <enter the DHCP Reserved IP address for the Xbox you created earlier>
    Private UDP Port(s): 88, 3074
    Private TCP Port(s): 3074
    Click "Continue"

  • I want to get windows vista on the macbook pro with retina display but my first question is this that how do i install it without using a DVD OR CD disk drive, and my second question while installing windows vista do i have to tick mark the install win 7

    hello i have a few problems and i hope somebody has a solution my first problem is that how can i install windows vista without using a disk drive and my second problem is that should i tick mark the option which says Install windows 7 while using boot camp please reply, Thanks,

    When running Windows in a virtual environment Windows and OSx share your computer's resources such as RAM. Therefore your games can not use all your computer's resources when running.
    If you install Windows natively then Windows and your games can and do use all your computer's resource such as RAM.
    But as already said, older operating systems are not supported and will not run natively using Boot Camp Assistant. You must use Windows 7 if installing natively in Lion or Moubtain Lion.

  • Stupid question, but i NEED an answer

    can the ipod touch get internet anywhere (like the iphone) or only wi-fi
    please answer cause im thinking about buying one

    Only at wifi spots.
    The iPhone uses a phone network that is essentially everywhere.
    FWIW, Starbucks has dumped T-Mobile and are going with AT&T and will offer a limited free wifi at all it's locations.

Maybe you are looking for