Can somebody help me in notifying the thread from junit class.

I am writing a junit test case for the following kind of scenario.
There is a private inner class B that is enclosed with in class A.
class A
int i=1;
B threadB;
void AFun()
while(i<10)
threadB=new B();
threadB.start();
if(i%2==0) {
i++;
threadB.notifyThread();
private class B extends Thread
void run()
while(true)
System.out.println(i);
i++;
waitThread();
if(i==10) {
break;
public synchronized void waitThread(){
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
public synchronized void notifyThread(){
this.notify();
now i want to notify class B from the junit class ATest if the thread is in waiting state.. is there any way to notify the class B threadB from test class.
//JUNIT Class
Class ATest
Class c;
A a=new A();
c=a.getClass();
Field BThread=c.getDeclaredField("ThreadB");
BThread.setAccessible(true);
Object obj=BThread.get(a);
a.AFun();
while(true){
if(((Thread)obj).getState()==Thread.State.WAITING)
// Is there any way to notify the thread B that is waiting or to call notifyThread of private class B over obj
}

Well, sinced no one has any ideas, here's my two cents worth.
You can create a public static class variable in either Class A or Class B. as follows:
public static String temp;
Then either class can change the value by having this in a function:
ClassA.temp="abc"
and either class can read it from within a function by calling
String n1= ClassA.temp;
If you want to get fancy, you can put use a java collection instead of a string. The collection will store various information on what your doing such as which class changed the value and when.

Similar Messages

  • I suspect a spy app on my iphone 4 that somebody watching my calls/ voice conversation. Can somebody help me to identify the app and how to remove it?

    I suspect a spy app on my iphone 4 that somebody watching my calls/ voice conversation. Can somebody help me to identify the app and how to remove it?

    No spy app can be installed on iphone which is not jailbroken.
    For example iKeyMonitor iPhone spy can not be installed without jailbroken.
    http://ikeymonitor.com

  • I have an iphone5. I want a software through which I can block some incoming calls,can somebody help me to locate the best one

    I am having an iphone5. I am looking for a software through which I can block some numbers to avoid incoming calls from them.please help me in this regard.

    Enter those numbers into your contacts and assign them a silent
    ringtone. The calls still come in, but you will not hear them.
    True call blocking is a function of your wireless provider. If that
    is what you want, do as AnaMusic stated above and contact your
    Carrier.
    Due to the sandbox nature of iOs, no third party app can do what you
    want.

  • Can somebody help me to find the reference manual of LabVIEW version 6.1?

    i am searching for the reference manual of the LabVIEW 6.1, if somebody can help me where to find it.
    thank you.
    Rani Bhanniny

    They're all online. e.g.: LabVIEW 6.1 User manual..
    All the rest can be found here.
    LabVIEW Champion . Do more with less code and in less time .

  • TS1424 I'm getting a message that indicates "Itunes has stopped working.  A problem caused the program to stop working. Windows will close the program and will notify you if a solution is available.  But I never get a response.  Can somebody help?

    When opening Itunes, after placing my ID and password, I'm getting a message that indicates "Itunes has stopped working.  A problem caused the program to stop working. Windows will close the program and will notify you if a solution is available.  But I never get a response.  Can somebody help?

    Same exact thing with me.  And no help from apple.  Just dropped nearly $600 and cannot get a decent working setup.
    Apple's only suggestion was to uninstall iTunes and Quicktime, and re-install... of course (the I.T. Crowd tactic).
    The crash happens only on iTunes store access.

  • Can somebody help me in finding a solution or an explanation to the problem I am currently experiencing as well as others wherein we cannot connect to the iTunes store (iTunes could not connect to the store. An unknown error occurred (0x80096004))?

    Can somebody help me in finding a solution or an explanation to the problem I am currently experiencing as well as others wherein we cannot connect to the iTunes store. An error message appears and either says "iTunes could not connect to the store. An unknown error occurred (0x80096004). Make sure your network connection is active and try again" or "iTunes could not connect to the store.Make sure your network connection is active and try again." Despite the fact that my network connection is working quite fine, this problem still persists. I can say that my connection is fine because I can surf the internet and furthermore, I used to connect to the iTunes store just before this incident happened which started from April 17, 2014 and persists until today. I tried to solve the problem by following the troubleshoot procedures given in the support section of this site but it really did not solve the problem. I believe that others are experiencing this situation as well very similar to mine when it comes to the time of occurrence as I have read in the discussions in this site. Even though we have different network connections, operating systems and other specifications, we still experience the same problem, so is there really a problem with our computers or is it with the iTunes? And by the way, my computer works under Windows XP. Thanks a lot. God bless.

    Try this...
    Triple click anywhere in the line below to select it and press Ctrl+C to copy it.
    cmd /k netsh winsock reset
    Press the WinLogoKey+R to open the run dialog, then Ctrl+V to paste, then press enter/return.
    You should get something similar to this:
    Reboot the computer and the problem should be resolved.
    If it doesn't work then perhaps a full tear down and rebuild of iTunes will fix things. See Troubleshooting issues with iTunes for Windows updates for details.
    tt2

  • I am new with iMac and I am trying to copy some file from my external HDD but it does not let me also I can't delete anything from this HDD using the finder. Can somebody help me , please?

    I am new with iMac and I am trying to copy some file from my external HDD that a used with my PC but it does not let me also I can't delete anything from this HDD using the finder. Can somebody help me , please?

    No, unfortunately, when you format a drive, it will erase all the contents. So you will need to find a temporary "storage" place to put the stuff using a PC so you have access to it. Then reformat using Disk Utility (Applications > Utilities). If only using with mac, format Mac OS Extended (Journaled) and use GUID Partition scheme under Partitions/Options. After formatting, you can drag the files back.

  • My new I5 uploaded doubleded all the songs from my library! Please, can somebody help me showing how can I delete just the songs that was doubled?

    Hi there everybody,
    My new Iphone 5 uploaded doubleded all the songs from my library! Please, can somebody help me showing how can I delete just the songs that was doubled?
    Some help will be greatly appreciate.
    Thanks much!

    When you say "account," do you mean your iTunes library, because your iTunes library is what is on your computer?  Your iTunes library does not have an email address.  An account that is related to iTunes is your Apple ID (which is an email address) and you use it as your user name to sign in to the iTunes Store, to make purchases.  Changing your Apple ID will not make songs disappear from your computer's iTunes library.
    If you had an Apple ID and used it to make song purchases from the iTunes Store, and then started using a different Apple ID, you should be able to re-download the songs purchased with the old Apple ID.  In iTunes, sign in to the iTunes Store using your OLD Apple ID (and password).  That may not be your current email address, but Apple uses it as your user name, so it does not matter.
    On the iTunes Store Home screen, click on Purchased under QUICK LINKS.  This takes you do the Purchased screen, where you can re-download previous song purchases (for that Apple ID) at no cost. 
    NOTE:  If those song purchases are from more than a few years ago, you may also need to authorize your computer to play (and sync) songs for your old Apple ID. 
    For songs that were not purchased from the iTunes Store, if they are also gone, you cannot get them back unless you have a backup (or they are still loaded on your old iPod).
    If that's not what you mean by "changed the email address on my account," please post back with more details.

  • I can´t sync iCal events written in the iphone4 to the macbook ical, but conversely from macbook to iphone there´s no problem, can somebody help me?

    I can´t sync iCal events written in the iphone4 to the macbook ical, but conversely from macbook to iphone there´s no problem, can somebody help me?

    Thanks for your answer! I tried as you say, erase the Sync History, but now does not sync any calendar, only displays the birthday ...do not know whatelse to try.

  • My account was deleted for security issues. I made a new account, but I can't syncronise my apps with this new account. I bought a new Iphone and would like to transfer the apps ans music on this new one. Can somebody help me?

    My account was deleted for security issues. I made a new account, but I can't syncronise my apps with this new account. I bought a new Iphone and would like to transfer the apps ans music on this new one. Can somebody help me?

    Why would you make a new account?  This will likely cause many problems.  Just get you old account enabled.
    Apple ID: "This Apple ID has been disabled for security reasons" alert appears
    Frequently Asked Questions About Apple ID
    Everything you purchased with the old account will always be tied to that account.  You will have to authorize the computer for that account and you will have to update the apps from that account.

  • I drained my ipad's battery and trying to charge it. but it won't turn on. i tried it overnight but still the ipad is dead. can somebody help me?

    i drained my ipad's battery and trying to charge it. but it won't turn on. i tried it overnight but still the ipad is dead. can somebody help me?

    Try this  - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased.
    Frozen or unresponsive iPad
    Resolve these most common issues:
        •    Display remains black or blank
        •    Touch screen not responding
        •    Application unexpectedly closes or freezes
    http://www.apple.com/support/ipad/assistant/ipad/
    iPad Frozen, not responding, how to fix
    http://appletoolbox.com/2012/07/ipad-frozen-not-responding-how-to-fix/
    iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
    http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
    Black or Blank Screen on iPad or iPhone
    http://appletoolbox.com/2012/10/black-or-blank-screen-on-ipad-or-iphone/
    What to Do When Your iPad Won't Turn On
    http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    Home button not working or unresponsive, fix
    http://appletoolbox.com/2013/04/home-button-not-working-or-unresponsive-fix/
    Fixing an iPad Home Button
    http://tinyurl.com/om6rd6u
    iPad: Basic troubleshooting
    http://support.apple.com/kb/TS3274
     Cheers, Tom

  • ITunes tells me, that I need to load version 11.1 in order to load a backup into my iPhone 5. I'm working with a windows PC and want to update my phone to iOS 7GM. version 11.0.5 is the highest I can get for windows. Can somebody help me?

    iTunes tells me, that I need to load version 11.1 in order to load a backup into my iPhone 5. I'm working with a windows PC and want to update my phone to iOS 7GM. version 11.0.5 is the highest I can get for windows. Can somebody help me?

    I'm assuming you followed a forum like Gizmodo to load the latest version of iOS 7 Beta on your device
    Alot of those forums forget to mention, iTunes 11.0.5 will allow you to update to the iOS 7 Beta but your device will no longer work unless you have the developer version of iTunes as well....
    I'd suggest you to research how to downgrade back to 6.1.3/4 and wait a few days for the iOS to be released,

  • Can somebody help me! which beamer would be the best for my macbook air?

    Can somebody help me! which beamer would be the best for my macbook air?

    I think that VLC Media Player will play avi files.
    Regards,
    Clinton

  • Vocals cannot be heard with the headphones, but they can without. Can somebody help me?

    When I put my headphones in my Ipod Touch 3g, I can't hear the vocals. The music is fine, but I can't barely hear the vocals. When I put other headphones in it, it has the same problems. So it's not the headphones. Can somebody help me?

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so. There is a little switch in the headphone jack that disconnects the speaker when the headphone jack is inserted.
    - Reset the iOS device. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iOS device.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    If not under warranty Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself
    iPod Touch Repair – iFixit

  • HT204380 Facetime Activation: Could not verify the email address. Please re-enter and try again.   Tried so many times,even changed my appe ID and purchased a new facetime for iMac running 10.8.4 Mountain Lion,yet still same outcome. Can somebody help me?

    Facetime Activation: Could not verify the email address. Please re-enter and try again.   Tried so many times,even changed my appe ID and purchased a new facetime for iMac running 10.8.4 Mountain Lion,yet still same outcome. Can somebody help me?

    I have the same problem. FaceTime works fine on my iMac but when trying to use FaceTime on my Macbook Air, I have the same issue you describe.

Maybe you are looking for