Vector is not  a Thread safe so where be use it and why?

Can anyone tell me
When Vector is not a Thread safe so where be use it and why?

Suppose you use a Vector<Listener> to store your list of listeners. While the Vector class is thread-safe, which means that its methods can be called without additional synchronization without risk of corrupting the Vector data structures, iterating a collection involves "check-then-act" sequences, which are at risk of failing if the collection is modified during iteration. Let's say there are three listeners in your list at the start of iteration. As you iterate through the Vector, you repeatedly call size() and get() until there are no more elements to retrieve, as in Listing 1:
Listing 1. Unsafe iteration of a Vector
Vector<Listener> v;
for (int i=0; i<v.size(); i++)
v.get(i).eventHappened(event);
But what happens if, just after you call Vector.size() for the last time, someone removes a listener from the list? Now, Vector.get() will return null (which is correct, because the state of the vector has changed since you last checked), and you will throw a NullPointerException when you try to call eventHappened(). This is an example of a check-then-act sequence -- you check to see if any more elements exist, and if so, you get the next element -- but in the presence of concurrent modification, the state could have changed since the check.
I read that at IBM sites
Thanks in advance for clearing my doubts...

Similar Messages

  • Why does my mail disappear on both iPad and iPhone4... only sometimes.  It's not in the trash so where does it go and why?

    Why do I lose mail from my iPhone4 and recently from my iPad2?  It happens infrequently, but when it does the messages completely disappear from my device(s); the messages are not in my trash. 

    OK, so I decided that maybe if I "sync" my iPod instead of just copying stuff to it at will, that maybe it would fix the problem.  I did a "restore", wiping out the contents.  I set up a "playlist", and put everything that I wanted on the iPod into the "playlist".   Then I "synced" the "playlist" onto the iPod.  Every song and album now had the proper album art.  I could live with this.   Then I added another album to the "playlist", and "synced".  The new album was now on the iPod with the correct artwork.  The albums that were already on the iPod now either had their appropriate artwork, no artwork, or the artwork from the other albums that were already on the iPod, with no rhyme or reason as to which was which.  AARGH.   I wiped it out and re-added the now-explanded "playlist" and "synced" again, and every album had the right cover.   I guess the only thing to do is completely replace the contents of the iPod any time I want to add or change anything, or forget about artwork.

  • The get() of Vector class, is it thread safe??

    Hi all:
    the get() of Vector class, is it thread safe?? I looked into the API, but no info is available, so any help is appreciated

    You just have to look out when you perform two or more methods on the Vector in sucession. Then it's better to lock on the vector itself. If you for instance access the vector to query whether the size is greater than zero and immediately remove an item while another thread is removing elements from the same vector, you might get a dirty read and call get() on the vector while there are no elements left.

  • I can not find mozilla firefox folder in Start All Programs how can i open firefox in safe mode i am using win7 and firefox 4.ob10 ?

    i can not find mozilla firefox folder in Start>All Programs> how can i open firefox in safe mode i am using win7 and firefox 4.ob10 ?

    A quick workaround - Go to Start > Run, and paste this in the box: "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -safe-mode

  • When my Itunes diagnostic's finishes running it says Itunes not running in safe mode. What is that and how do I enable it?

    My Itunes diagnostic's say's that my Itunes is not running in safe mode. What is this and how do I enable it? I have the latest version of Itunes.

    you cannot update this software because you have not owned the major version of this software
    Shouldn't give away the secret of how easy it is.....

  • I m not able to find out where is check out and open component(WCM)

    hi everyone,
    i m not able to find out where is check out and open component and how it works. As m not able to open & edit the native document that m assigning.Plz help me in this ASAP

    Here's what I found. If you have a metalink login, try these links. Depends on what version of COAO you need.
    CheckoutAndOpenInNative
    Patch 6602355 Build version=2007-03-22 for 10.1.3.3.1
    http://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6602355
    Version=2007-03-22 on edelivery in UCM Downloads
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12648830947583585595::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,455524.1,1,1,0,helvetica#downloads
    Version=7.7.0.244-2006-07-31 on edelivery in UCM Downloads
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12648830947583585595::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,455524.1,1,1,0,helvetica#downloads
    There's actually a mapping here to figure out what file these extras are in:
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12648830947583585595::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,455524.1,1,1,0,helvetica

  • What is mean by Referential Integrity? Where do we use it and Why..?

    Hi All,
    Can anybody tell me, What is mean by Referential Integrity? Where do we use it and Why..?
    Regards,
    Kiran Telkar

    Dear Kiran Telkar ,
    you might be knowing that generally refrential integrity is concerned with nothing but primary key and foriegn key relationship. Generally we use to check uniqueness of records.
    In sap we use it during flexible updation...to check the data records of transaction data and master data.
    In other words, to check before loading of data, that whether loading will be properly or not.
    we will check(tick) the option in the maintainance of the
    <b>infosource--> communication structure</b>
    it will be better if you clearly mention your problem, if further help is needed.
    hope this will help you.
    Regards
    vinay
    <i>please assign points to all who will help you.</i>

  • What has happened? Where is my iPhoto and why are my photos now in Photos. This *****. The whole reason I bought a Mac was the ease of iPhotos. Horrible.

    What has happened? Where is my iPhoto and why are my photos now in Photos? This *****. The whole reason I bought a Mac was the ease of iPhotos. Horrible. Bad move.

    iPhotos is still in your Applications folder. The iPhoto Library is still in your /Home/Pictures/ folder.

  • I had 200 song the i have bought and now i only have 4 purchased songs where did they go and why dd this happen i didnt spend all this money for them to disappear.

    i had 200 song the i have bought and now i only have 4 purchased songs where did they go and why dd this happen i didnt spend all this money for them to disappear.

    sorry to hear that. You can try redownloading them from iTunes in the Cloud or from your purchased page:
    Downloading past purchases from the iTunes Store, App Store, and ...
    support.apple.com/kb/ht2519 
    This article may also help you locate them:
    iTunes: Finding lost media downloads
    http://support.apple.com/kb/TS1408

  • Why does Verizon not provide 3G coverage in Western Maryland (Garrett County) and why does it not have an agreement with US Cellular for such coverage?

    Why does Verizon not provide 3G coverage in Western Maryland (Garrett County) and why does it not have an agreement with US Cellular for such coverage?

        Thanks for the zip code pfekete. I looked into the coverage in your area and I do see you are in an extended 1X data coverage which explains why you're not connecting to 3G. What phone do you have? We may be able to advise you on how to adjust the settings so it picks up the strongest signal. I apologize for the inconvenience.
    AdaS_VZW
    Follow us on Twitter at @VZWSupport 

  • Hi - I cannot upload my emails through the mail icon.  The first time I tried it only loaded very old emails, I then tried the whole process again and it has not imported a single email.  I use hotmail, and have had no problems with my iPhone or iPad.

    Hi - I cannot upload my emails through the mail icon.  The first time I tried it only loaded very old emails, I then tried the whole process again and it has not imported a single email.  I use hotmail, and have had no problems with my iPhone or iPad.  So the only way I can check my emails on my mac is to go through the internet.  Can anyone help?

    Hello, do you mean Download?
    In Mail's Window Menu, choose Connection Doctor, any red dots for status, if so what is the message?
    Then click the Show Details button & Check again.

  • Oracle BI what is cubes and dimention and where we use cubes and dimention

    Dear ,
    I am working on Oracle BI.
    what is cubes and dimentionS and where we use cubes and dimention
    Please give a link where i get stuff regarding cubes and dimentions.
    thanks

    Possibly you are lost in the wrong forum category ...
    Post your query in:
    Hyperion EPM

  • Is anyone else having trouble viewing the SEC network via Watch ESPN on a 2nd gen Apple TV?  Software is up to date, but SEC network not showing up as a channel.  Using Xfinity - and it appears on iPhone5 but not on iPad2 - both of which ar

    Is anyone else having trouble viewing the SEC network via Watch ESPN on a 2nd gen Apple TV?  Software is up to date, but SEC network not showing up as a channel.  Using Xfinity - and it appears on iPhone5 but not on iPad2 - both of which are current on IOS. Help!

    the wifi router could also be blocking
    and to really test if the windows firewall is the problem then try turning it off!
    if that scare you too much then disable the internet modem / cable modem or the likes while you test
    always remove more and more factors when troubleshooting sooner or later it will work and you can narrow down which factor did the job and work on that

  • BC4J View not Thread safe, user sessions are using the same view instance

    Hi There,
    We are using BC4J that came with JDeveloper 10.1.2.0.0 with Oracle 10G 10.1.2.0.0.
    I have an BC4J account search view (BC4J AccountSearchView) that users can call to search for an account. So this view could be used by numerous users and pieces of code at the same time. Now my understanding is that each user gets their own instance of the view so changing the view's query should not be an issue (since the view definition is not changing). Under a light load the account search view looks like everyone get there own instance of the view and there expected account search results. But under a heavy user load when we have User A and User B the search query that was for User A will be used by User B. So the user results for one user will get the other users results.
    I do not understand if the view definition is been changed by the other user and is impacting all view instances. How can this occur if it is thread safe?
    I have enclosed the core code for this search.
    If you can help that would be much appreciated, thanks in advance,
    Nigel
    accountSearchView.setQuery(baseSelectQuery+generateWhereClause());
    logger.debug("SearchAccounts Query: "+accountSearchView.getQuery());
    System.out.println("SearchAccounts SQL: "+accountSearchView.getQuery());
    accountSearchView.setPassivationEnabled(false);
    accountSearchView.setForwardOnly(true);
    accountSearchView.executeQuery();
    get attributes for each row result and place in new Java bean objects and return to user.

    Nigel, we've only certified JDeveloper 10.1.2 against the Struts 1.1 with which it ships.
    If there have been any changes in Struts 1.2 to the Struts Request Processor, then this could easily have an impact on the BC4JRequestProcessor's correct functioning, depending on what the changes were.
    My quick look into the issue tells me that the ActionServlet init parameter named mapping in web.xml that we use for the 9.0.3-style BC4J/Struts integration is getting ignored by Struts 1.2. This parameter is used by Struts 1.1 to globally configure a custom ActionMapping subclass which can support additional properties. My quick test shows me that Struts 1.2 is ignoring this setting and so the oracle.jbo.html.struts11.BC4JActionMapping subclass of Struts's default ActionMapping is not getting used correctly as it does in Struts 1.1. This leads to errors when Struts tries to configure its actions in struts-config.xml since the Apache digester tries to set properties on the ActionMapping instance that don't exist (since the BC4JActionMapping has these properties, and it's not being used).
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>mapping</param-name>
          <param-value>oracle.jbo.html.struts11.BC4JActionMapping</param-value>
        </init-param>
      </servlet>This is my quick analysis of what's not out-of-the-box compatible. I don't know enough about the changes in Struts 1.2 to know why this Struts 1.1 feature broke in Struts 1.2, or what the Struts 1.2 way to accomplish the same thing is.
    I'd encourage you to use Worldwide Support's Metalink site and open a TAR for any time-critical issues you need assistance in resolving. Many of us are constantly traveling and only able to sporadically chime in with tips in the forum as our time permits.
    The source of the BC4JRequestProcessor ships with the produce in the ./BC4J/src directory inside the bc4jstrutssrc.zip file.

  • Hello all, I saw this message in my Iphone 5 notes. it reads " Stop! who are you? And why can I read your and you my notices??" Please has anyone had any similar experience? Any suggestions/solution would be greatly appreciated. Thanks

    Hello all,
    I saw this message in my Iphone 5 notes.
    It reads " Stop! who are you? And why can I read your and you my notices?? "
    I did not write it.
    Please has anyone had any similar experience?
    Any suggestions/solution would be greatly appreciated.
    Thanks

    oliverMili wrote:
    Hello all,
    I saw this message in my Iphone 5 notes.
    It reads " Stop! who are you? And why can I read your and you my notices?? "
    I did not write it.
    Please has anyone had any similar experience?
    Any suggestions/solution would be greatly appreciated.
    Thanks
    I had a similar experience with mac e-mail where apparently someones ICLOUD id for their Iphone was created with an Alias I had @mac.com for years.  Originally thought the mail was phishing and deleted without opening - then received forwarded mail from the other persons non-apple account - so gave feedback through mail to apple and also sent an email to the other persons non-apple account from a non-apple account telling them I was getting their mail because it was my alias.    
    That person did get apple to untangle the accounts so I did have to reset my password once it was done.
    So one option would be to contact apple support to get them to find out what is going on with your account.
    E-mail contact of the other person was easy once I had a legit account to send to -- don't know how you would contact the other person in notes.

Maybe you are looking for

  • How do I transfer music and stuff from my ipod onto my itunes library on my new laptop?

    I got a new laptop and i plugged my ipod in and everything was okay but the music that is on my ipod is not in my itunes library it is just in the drop down music menu when my ipod is plugged up to my laptop. So, i hit sync and it said either transfe

  • Unknown error (-69) HELP!!!!

    when I try to update my iPod this error appears: ""attempting to copy to the disk "MY IPOD" failed. an unknown error occurred (-69)."" So i cleared all the songs of my iPod and tried moving them manualy but the error message still popped up. So i tri

  • Special Ledger - Plan version 0

    Hi all! I have setup Special Ledger with plan version 0 active.  If I manually create planning on plan  version 0 on projects or cost centers, the plan $ are replicated in SPL as whished.  But If I plan hours in a network activity, the plan values ar

  • Firefox doesn't open up even after reinstalling

    The window of the program opens but none of the icons are visible. I tried to reinstall Firefox but it didn't help. I don't get the message about any error. My operating system is Windows 7.

  • How does AirPort Utility communicate with remote/relay AirPorts?

    1. Wireless case: Does the AirPort Utility always try to communicate with remote/relay AirPorts directly, or does it use the network WDS when another AirPort provides a stronger signal? If it's the former option, this might explain why people have pr