What will happen if I don't synchronize?

Imagine I have a top level singleton object of class Team. This object has a Collection field of objects of class Player. The Team object also has an object reference field that points to a Coach object. The Team class has methods to return, add to, and remove items in the Player Collection, as well as set and get the Coach object.
In addition, assume that the Player and Coach classes also have methods, some of which mutate internal data and others which are guaranteed not to mutate internal data.
Finally, I have two threads, MainThread and ObserverThread. Only MainThread will call methods of Team, Player, or Coach that mutate data. ObserverThread will only call methods that "read" the data, that is, only methods that do not mutate any data. Further, the data obtained by the ObserverThread need only be a best effort; it does not need to be accurate. It doesn't even matter if it makes sense all of the time. My question, then, is do I need to synchronize access to Team, Player, and Coach? What are the possible bad things that can happen if I don't?
As stated, I don't care if the data I get back is wrong. But are there any RutimeExceptions that I'm likely to encounter? Can an unsynchronized read corrupt the data? Are there other possible bad things?
Thanks in advance.

Can an unsynchronized read corrupt the data? Yes.
Are there other possible bad things?Yes, I have seen the JVM lock up when reading writing the same data in an unsynchronized collection.
I would suggest using synchronization and only optimising it when you know there is a performance issue. Deadlock issues don't count, these are coding errors.

Similar Messages

  • What will happen if I don't use apple's hdd?

    My HDD is passed away.
    I'm using Macbook Unibody(A1342) and I will replace the HDD.
    I heard that Apple's HDD has a temperature sensor.
    So that If I don't use that, it will be a problem, as I heard.
    What will happen if I don't use the Apple's HDD?

    The tempeture sensor is on the logic board not the hard drive. Apple doesn't make any hard drives they buy them from other manufacturers.
    For a new hard drive try Newegg.com  
    Regular SATA drives http://www.newegg.com/Store/SubCategory.aspx?SubCategory=380&name=Laptop-Hard-Dr ives&Order=PRICE  Use the list at the left for larger and faster drives.
    SSD drives
    http://www.newegg.com/Internal-SSD/SubCategory/ID-636?Order=PRICE  Use the list at the left for larger and faster drives.
    Or OWC for regular hard drives and SSDs  http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    Here are video instructions on replacing the hard drive on the White Unibody http://eshop.macsales.com/installvideos/macbook_13_09_unibody_hd/
    To transfer your current hard drive I like the applications Carbon Copy Cloner or SuperDuper. They make a bootable copy of everything on your hard drive. http://www.bombich.com/index.html or http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html 
    You'll need a cheap SATA external hard drive case. Put the new drive in the case then format and partition the new drive and clone your old drive to the new one. Check that it's set up right by booting up from the external drive. Then replace your old hard drive with the new one and put your old one in the external case.
    Here's a cheap SATA external hard drive case on Amazon http://www.amazon.com/Vantec-NexStar-2-5-Inch-External-Enclosure/dp/B002JQNXZC/r ef=pd_cp_pc_0
    If you don’t have the tools to open up the MacBook OWC has a set for $5
    http://eshop.macsales.com/item/OWC/TOOLKITMHD/

  • What will happen if I don't download ios 7

    What will happen if I don't download ios 7

    Well, for one thing, you won't get the Download Error notice.
    Seriously, nothing will happen. What did you think would happen?

  • What will happen if you don't upgrade your ipad 2  ios5.1.1 to ios6?

    hey guyz can u plz give some advice if what will happen to your ipad if you don't upgrade your ipad 2  ios5.1.1 to ios6?is there a chance to have a virus if you dont upgrade it.?tnx so much.

    Whether you Upgrade or Not is your Choice...
    rhpz18 wrote:
    ...is there a chance to have a virus if you dont upgrade it.?..
    There are No Viruses for iOS at this moment in time...
    So all should be Fine.

  • What will happen if i don't restore from backup?

    what will happen to my itunes if i dont restore my ipod from my backup?

    Nothing happens to iTunes. However, if you don't restore the iPod Touch then your Touch will be restored to it's "as new" condition but with upgraded firmware (if that's what you are going to do.)

  • What will happen if I don't install foxfire 4?

    after reading through the many changes you want to provide. as a senior citzen and not wanting change I want to know what will happen to the platform i'm used to?

    You can keep on using Firefox 3.6. It is likely to be supported with security updates for quite a few more months.
    As you have Windows XP, by default Firefox 4 will look very similar to Firefox 3.6, it will use the old user interface unless you change it to use the new interface.

  • What will happen if I don't install ios7 on iphone5

    What would happen if I dont eventually install ios7 on iphone5? i've been hearing about all the battery drain issues and reluctant to install ios? I heard something about phone would not functioning properly because of updated new apps on an old software? Will apple fix this issue possibly?
    Back when I had a 3G and installed the new update my phone suffered drastically and for 4 yrs was stuck with a phone I had to charge constantly after 2-3hrs of consecutive use or less.

    Nothin will happen. you will be able to use the phone the way you are using it right now. Apps crashing is not actaully because of ios 7. ios 7 just came out so most of the app's developer havent actually made their apps compatible with ios7 thats why most ppl are having the issues. If the battery issue is because of ios 7 than Apple defintely will fix all the issues eventually with another update.

  • What will happen if I don't get my Mac fixed?

    Hello everyone. Just recently (about four days ago) my mom accidentally spilled a cup of Kool-Aid. It went into the side of my Macbook Pro, and in the back as well. It shut off right away and wouldn't turn on at first. My mom and I dryed it off as much as possible and took the back off for it to air off. I tried turning it on afterwards, and it did. It is currently working and I haven't had any major problems with it.
    However, when I took it to the Apple Store to make sure things were fine, the guy there told me it NEEDS repaired or it will eventually die. He said it would cost me 1,200 dollars, which is pretty much how much I paid for this Mac, to get it fixed. He said the stickiness from the Kool-Aid will eventually corrode the wires, causing my Mac to die.
    Is this true? Or was he trying to get me to buy a new one?
    If it is true, how long will my Mac last?
    Thank you in advance!

    Welcome to Apple Support Communities
    Any liquid could damage the whole MacBook Pro, and once you have spilt it, your Mac may stop working at any moment. See > https://discussions.apple.com/docs/DOC-5511
    That type of repairs are quite expensive because near everything is affected except the display, and maybe the hard drive. In conclusion, what the Genius told you is true. Now you have to decide whether you want to get your Mac repaired or get a new computer.

  • I know my battery desperately needs replacing, but what will happen if i don't replace it?

    Hi, so basically my battery is a gonner but i can't afford a new battery right now and need to use my MBP for work reasons. basically my (probably stupid) question is:
    if i continue to use it in this bad condition, could my computer be compeletly ruined? could it destory the hard drive or something? will it "exlplode"?(scrap probably, it is a stupid question right?)
    here's what it says in about my mac:
    Battery Information:
      Model Information:
      Serial Number:          W0*******7ZC
      Manufacturer:          SMP
      Device name:          bq20z451
      Pack Lot Code:          0000
      PCB Lot Code:          0000
      Firmware Version:          0003
      Hardware Revision:          0002
      Cell Revision:          0100
      Charge Information:
      Charge remaining (mAh):          3298
      Fully charged:          Yes
      Charging:          No
      Full charge capacity (mAh):          3298
      Health Information:
      Cycle count:          620
      Condition:          Check Battery
      Battery Installed:          Yes
      Amperage (mA):          0
      Voltage (mV):          12349
    <Edited by Host>

    Welcome to the Apple Support Communities
    I can see that the full charge capacity is too small for a Mac battery or, at least, for a recent Mac. However, I think that OS X is displaying that you have check the battery because its capacity has decreased a lot.
    In this case, you can continue using the MacBook Pro until the battery stops working at all or because it doesn't meet your requirements of using the battery. If you can't afford a new battery, wait until you can change your battery

  • What will happen to the stuff in my keychain after today? I don't want iCloud. Can I keep the keychain? in my system?

    what will happen to the stuff in my keychain after today? I don't want iCloud. Can I keep the keychain in my system under lion? Can someone please help me?

    Thank you Sig. Well I keep all my passwords in my keychain. I'm concerned I'll lose them after today. I understand that keychain will be obsolete after today. I don't want icloud either, because I don't want all my personal info on a server. I want to keep my personal information in my system. Am I making any sense? Can you make any suggestions or offer any insights around this? 

  • Dispite I downloaded app video calling for facebook from appStore, my safari on my MacBook don't work, instead app wants to change browser. If I do this (changing user-agent) what will happen with my safari???

    Dispite I downloaded app video calling for facebook from appStore, my safari on my MacBook don't work, instead app wants to change browser. If I do this (changing user-agent) what will happen with my safari??? I have new (updated 10.7.1) OSX, Lion !!!
    Kind regards!
    Petar

    Dispite I downloaded app video calling for facebook from appStore, my safari on my MacBook don't work, instead app wants to change browser. If I do this (changing user-agent) what will happen with my safari??? I have new (updated 10.7.1) OSX, Lion !!!
    Kind regards!
    Petar

  • I have macbook pro 15 inch that i upgraded recently. i have been so frustrated because my internet keeps dropping out constantly. when will apple fix this? and if they don't what will happen to other people that are having wifi problems

    i have macbook pro 15 inch that i upgraded recently. i have been so frustrated because my internet keeps dropping out constantly. when will apple fix this? and if they don't what will happen to other people that are having wifi problems?

    Have a read through one of the many threads already going on this subject
    https://discussions.apple.com/thread/3190651?start=0&tstart=0

  • HT4623 What would happen if i don't update my ios to the latest software version? Will it cause my iphone to malfunction?

    I have been experiencing signal related concerns like connecting to 3g network eversince a new software update becomes available in the settings notification. I didn't update to the latest software version because i find it time consuming and tedious. What will happen now if i refused to update my iphone software, will it cause my device to not work properly? Kindly enlighten me, thank you!

    No, you can ignore it for as long as you like, but it sounds as though your phone is already not working properly. Though the following updates do not specifically address your concern it is possible that it could help.
    About iOS 5.1 Software Update
    This update contains improvements and bug fixes, including:
    Japanese language support for Siri (availability may be limited during initial rollout)
    Photos can now be deleted from Photo Stream
    Camera shortcut now always visible on Lock Screen for iPhone 4S, iPhone 4, iPhone 3GS and iPod touch (4th generation)
    Camera face detection now highlights all detected faces
    Redesigned Camera app for iPad
    Genius Mixes and Genius playlists for iTunes Match subscribers
    Audio for TV shows and movies on iPad optimized to sound louder and clearer
    Podcast controls for playback speed and a 30 second rewind for iPad
    Updated AT&T network indicator
    Addresses bugs affecting battery life
    Fixes an issue that occasionally caused audio to drop for outgoing calls
    About iOS 5.1.1 Software Update
    This update contains improvements and bug fixes, including:
    Improves reliability of using HDR option for photos taken using the Lock Screen shortcut
    Addresses bugs that could prevent the new iPad from switching between 2G and 3G networks
    Fixes bugs that affected AirPlay video playback in some circumstances
    Improved reliability for syncing Safari bookmarks and Reading List
    Fixes an issue where 'Unable to purchase' alert could be displayed after successful purchase
    Just be aware there is no going back. iOS updates are one way only.

  • I'm worried about what will happen if I delete my recent backup data from the phone I still own? Will I lose any progress in games that was saved in the backup?

    I'm worried about what will happen if I delete my recent backup data from the phone I still own? Will I lose any progress in games that was saved in the backup?
    I have an iPhone 4S and I keep getting those irritating notifications that tell me I need to upgrade my storage or free up space. I've deleted all I can from my music and photos without losing too many precious memories, but it's come to the point where I think I need to delete backups. However, I'm just worried that I will lose all and any log-in information that I don't remember and app/game progress that was saved to the iCloud. Please Tell me what will happen/what I can do?

    If you are asking what happens when you delete an iCloud backup, it only deletes the backup from your account.  It won't do anything to the data on your phone or in your iCloud account.  If you don't need to backup you can delete it.  (If you no longer want to back up your phone to iCloud, turn iCloud backup off in Settings>iCloud>Backup.  Then your phone will back up to your computer each time you sync it with iTunes.)

  • I have a Power Mac G5 Dual 2.3 running 10.5.8, I understand that I can not upgrade to Lion, so what will happen to my Mobile me, which I can not live with out?

    I have a Power Mac G5 Dual 2.3 running 10.5.8, I understand that I can not upgrade to Lion, so what will happen to my Mobile me, which I can not live with out? Also will I be able to get Icloud to work?

    Hi Mary, the other so called "Features" of iClound will not work for like Syncing, but eMail will.
    MobileMe & dot Mac will still work last I heard.
    iCloud Mail setup, even in 10.4/10.5…
    Don't delete your old account yet. Just setup a new one in Mail>Preferences>Accounts, little plus icon. Choose IMAP as account type, not ,mac or MobileMe.
    IMAP (Incoming Mail Server) information:
              ▪          Server name: imap.mail.me.com
              ▪          SSL Required: Yes
              ▪          Port: 993
              ▪          Username: [email protected] (use your @me.com address from your iCloud account)
              ▪          Password: Your iCloud password
    SMTP (outgoing mail server) information:
              ▪          Server name: smtp.mail.me.com
              ▪          SSL Required: Yes
              ▪          Port: 587
              ▪          SMTP Authentication Required: Yes
              ▪          Username: [email protected] (use your @me.com address from your iCloud account)
              ▪          Password: Your iCloud password

Maybe you are looking for

  • How to install creative suite 4 on windows 8.1?

    I have a new Windows 8.1 laptop and am trying to install Creative Suite 4 on it.     I was able to do this on another laptop with 8.1, but that was over a year ago.   When I tried installing to the new computer from the CD, I got a message that "the

  • How do i reduce the size of the pdf's scanned from my printer

    i scan from my printer to a pdf.  the file comes across way to big (2mb for 4 pages with no pictures & just text, etc.)  i have already re-set the settings on my scanner / printer to try to get the smallest dpi & image possible.  how do i get to the

  • Why are there multiple keychain records for same email account?

    I have noticed that it takes sometimes up to 45 seconds for Apple Mail to send (whoosh...) an email. Then I started getting an alert asking for my password intermittently. I checked my KeyChain Access and note 5 records for this email account dating

  • SP01: UI 2005SP1 PL2: problems enabling UDF

    Hi, i'm trying to enable and disable an UDF Editbox field via UI sdk. i succeed in disable the editbox UDF but can not enable it anymore, the error i receive is: Error - Item - The item is not a user-defined item  [66000-8] i succeed doind anable and

  • What to do next...please help?

    I am new to SAP BW. Once I have finished my process chains...what is the next steps. Should I test them? How to test them? Then how should we send them to production environment. If we have to test - is it UAT? Please someone help me..... Thank you S