Two objects created at the same time with the same hashcode

We have this object with the following constructor:
2010-06-24 00:10:31,260 [LoadBalancerClientSubscriber(3)(pid:24312)] INFO  com.intel.swiss.sws.netstar.application.caching.framework.data
set.synchronizer.DatasetSynchronizer - Initializing dataset synchronizer for: [/nfs/iil/iec/sws/work/damar/ds_cama/tmp/ds_126631277304794
/d81], i am com.intel.swiss.sws.netstar.application.caching.framework.dataset.synchronizer.DatasetSynchronizer@2ed3cae0
2010-06-24 00:10:31,260 [LoadBalancerClientSubscriber(5)(pid:24315)] INFO  com.intel.swiss.sws.netstar.application.caching.framework.data
set.synchronizer.DatasetSynchronizer - Initializing dataset synchronizer for: [/nfs/iil/iec/sws/work/damar/ds_cama/tmp/ds_126631277304794
/d31], i am com.intel.swiss.sws.netstar.application.caching.framework.dataset.synchronizer.DatasetSynchronizer@2ed3cae0Note that two objects are created by different threads with exactly the same hash code. Any idea if/how this is possible?

isocdev_mb wrote:
The last part definitely suggests already that relying on uniqueness is incorrect. Hash codes are very often equal on distinct objects, viz. new String("java").hashCode == new String("java").hashCode(). Use a class level counter as suggested earlier.For that case we would of course expect the hashCodes to be equal, since the objects are equal. But even in the case of non-equal objects that don't override hashCode, you can still get the same value. Or, for that matter, non-equal objects that do override it. There are 2^32 possible hashCode values. There are 2^64 possible Long values. That means that there are 2^32 Longs that have a hashCode of 1, 2^32 Longs that have a hashCode of 2, etc.
And for non-equal objects...
package scratch;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
public class HashCodeIsNotUnique {
  public static void main(String[] args) throws Exception {
    Map<Integer, Integer> hashCodeCounts = new HashMap<Integer, Integer>();
    int numObjects = 10000;
    for (int i = 0; i < numObjects; i++) {
      Object obj = new Object();
      int hashCode = obj.hashCode();
      if (!hashCodeCounts.containsKey(hashCode)) {
        hashCodeCounts.put(hashCode, 0);
      hashCodeCounts.put(hashCode, hashCodeCounts.get(hashCode) + 1);
    for (Map.Entry<Integer, Integer> entry : hashCodeCounts.entrySet()) {
      int key = entry.getKey();
      int value = entry.getValue();
      if (value > 1) {
        System.out.println(key + " occurred " + value + " times");
9578500 occurred 2 times
14850080 occurred 2 times

Similar Messages

  • When our iPad is in use on the internet, my iMac internet connection goes off. I can't get the two devices to work at the same time with the AirPort Express. Is there a setting somewhere I may have missed?

    When our iPad is in use on the internet, my iMac internet connection goes off. I can't get the two devices to work at the same time with the AirPort Express. Is there a setting somewhere I may have missed?

    When two or more devices conflict it typically means that the DHCP service is either misconfigured or is not running at all. DHCP provides IP addresses to local network clients.
    Is your AirPort Express base station the only router in your current network configuration? That is, is it connected directly to an Internet modem and not to another router upstream of it?

  • Can you use 2 sets of bluetooth headphones at the same time with the Ipad 4?

    Hi, I was wondering if anyone could tell me if I can use 2 sets of bluetooth headphones at the same time with the Ipad?
    It is so my children can watch a film or listen to music together.
    Thanks

    No

  • Is student version released at the same time with the full version?

    I downloaded the LR4 to see how it compares to a LR2 I have at the moment. Adobe clearly states that users testing the beta can get the full version after March 31, but I did not find any information regarding the the student version release. Has adobe released the student versions simultaneously with the full versions, upon product release?

    In the past, the student version has been the same price as the upgrade, and it has been possible to upgrade to a standard version from a student version. If that continues to hold, you'll be able to get LR4 immediately for the equivalent of the student price. Notice the "if" in that statement.
    Hal

  • I am having the hardest time with the screen protectors! HELP ME|!

    So I bought the Anti-Glare screen protector from the Apple Store fir my iPhone. The first time I out it on, it looked good, but when I really looked at it, it was crooked around the Home button which looked really stupid, so I took it off with some tape and repositioned the protector, but yet again, can not get it straight, but worse of all, because my house is filled with flying dust, the back of the protector is filled with dust and lint and smudges, so now I cannot use the first one, so i open the other and what happens? THE SAME THING!!! So I have 2 questions.
    1. What am I doing wrong, what is the best way to put these on? Should I take the protector off just a bit and place it on the phone and then let it fall into place? Or take it off completely and then place it and hope I get it straight the first time?
    2. I am going to buy some new protectors (Same brand and everything), but I am wondering, would the Apple store give me an exchange despite the fact I did this to the protectors? Has anyone done that before?
    Thanks!

    It took me THREE OF THE THINGS before I get one of them on -- luckily, once on, it has never had to come off, and that has been since July.
    I ended up putting a small piece of scotch tape at the bottom right corner, which helps you lift it up and reposition without having to lift it too far that desk lint and things get on it again.
    I actually got so fed up after the first two, when I went back to get the second package of them (since there are only two of them per pack) that the "Genius" assisting me said he was a pro and would put it on for me. After the "Genius" had himself used up two of the protectors and it still looked awful, he just gave me another pack and wished me well.
    The third one was the charm though, and it has worked perfectly ever since.

  • Can I record video and line in mixer at the same time with iPod touch?

    Can I record video and line in mixer audio at the same time, with the iPod touch?

    What is a "line in imxer audio" You can use an externeral mic plugged into the headphone jack to record auid for a video using the 4G iPod's camera.

  • Hi my iMac has decided to come up for the 5 time Work the ?  Symbol just tris time everytime i try to restart the iMac with any key it won't work, then I try also i knserted the installation dvd and it does not, If media is getting scratched in the drive

    Hi my iMac has decided to come up for the 5 time With the ?question mark   Symbol just this time when i try to restart the iMac with any key it won't work, then I try also to insert the installation dvd and stard with yhe C or D key
    Still no way to grt it starting, also I notice the DVD drive is getting scratched in the drive just before it outomaticly ejected.
    media is getting scratched after been used and ejected by my iMac without loading .
    Please help!!! I  to finish my college work and have no way of  work on it! HELP
    Thanks

    Boot off your *original* Install Disk while holding down the *d key*, (not c key), then run the extended Apple Hardware Test. Some disks require you to use the Option key at bootup to select AHT. Some models have a separate AHT CD. Some have it on the Disc #2.
    The Memory test can really only be trusted if it finds a problem, not if it doesn't find a problem.
    Memtest OS X...
    http://www.memtestosx.org/joomla/index.php
    Rember is a freeware GUI for the memtest ...
    http://tech.kateva.org/2005/10/rember-freeware-memory-test-utility.html

  • Is there a way to show two angles at the same time in the final edit rather than switch between them with Multicam?

    Can I show two angles at the same time in the final edit rather than alternate with Multicam?

    Stack two clips on top of each other and reduce the sizes. I think that's what you want.

  • I am in the middle of a job using CS 6, but at the same time opening the Creative Suite apps.  I created an InDesign file in CS 6, saved it, and now I can't open it. I'm getting this message: Cannot open file because it was saved with a newer version of A

    I am in the middle of a job using CS 6, but at the same time opening the Creative Suite apps.  I created an InDesign file in CS 6, saved it, and now I can't open it. I'm getting this message: Cannot open file because it was saved with a newer version of Adobe InDesign CC (10.1). You must use that version or later to open the file." AARRGGHH! So how do I access the file?

    Sounds like you opened and saved it in CC, so now you need to go back to CC and either complete the project there, or export to IDML to take it back into CS6.

  • I have created a form which needs to be completed once a week for 6 weeks. On completing week 1, weeks 2 - 6 are completed at the same time with week 1 information. please help?

    I have created a form which needs to be completed once a week for 6 weeks. On completing week 1, weeks 2 - 6 are completed at the same time with week 1 information. please help?

    Hello, thanks for replying.
    Yes they just copy to the next page, the fields are the same. The document is an observation to school lessons so it needs to be consistent but with different data on.

  • Every time I create an account with iCloud then try to open it I get wrong ID or password. Even when I enter my birth date I am told it is incorrect. I have done this several times with the same results.

    Every time I create an account with iCloud then try to open it I get an error message: wrong ID or password. Also when I enter my birth date I am told it is incorrect. I have done this several times with the same results.

    Oldcameraman
    Please do not duplicate a thread. The threads are answered as soon as possible. We are not Adobe. Just user to user.
    I have answered your most recent of the duplicates
    Premier Elements 13 Organizer Works. Editor doesn't. Log in doesn't work
    It is uncertain just how far we can go to help you since you do not appear to have Premiere Elements any
    longer.Seems you demanded a refund from Adobe Chat, got it, and now are left with a non purchased program which I
    am not sure can be used.
    Duplicates tend to confuse the person asking the question as well as those attempting to reply. As I suggested in the
    above mentioned thread, try to sort out your situation with Adobe via its Adobe Chat.
    ATR

  • The same file with the same name need to call two RFC's with the sequence

    i have to pick up the same file with the same name  and call the two RFC in sequence
    scenario.i have xxx.txt file.file should be proces first calling the first rfc .
    I created two different communication channels
    for the first sender file communication channel i should not use processing mode archive,delete,Test
    and only option is set read only.
    if i set the read only the file ..then i can not use the same file again to call second RFC.
    how we can acheive the above scenario?
    Regards,
    Hyma

    If you want to file need to be picked up twice in same folder, it seems it is hard for PI adapter to achieve it, you should look for API's that control adapters availibility.
    But if you have different folder, then it make your scenario simpler since you can process first time, then output to another folder, configure another adapter to pick up from different folder.
    Regards
    Liang

  • Is it possible to get 2-ch signals from TDS2012 oscilloscope at the same time with LabVIEW "7.0"?

    Hi, everyone.
    I've been trying to get the signals from 2-ch of Tektronix TDS2012 oscilloscope at the same time using IVI connection with LabVIEW "7.0"
    I've already searched this developer zone for the answer.
    I've tried the famous example: "IviScope - Acq Dual Wfm Edge Triggered.vi"
    and it gave me the error message like:
    Error -1074110451 occurred at IviScope Initialize With Options.vi
    Possible reason(s):
    Driver Status:  (Hex 0xBFFA600D) Primary Error: (Hex 0xBFFA600D) The Config Server module is not present on the system.
    I think I've installed all~ the required softwares for IVI. For example, ICP 2.2, IVI engine 2.0.46, and tktds1k2k ivi (instrument driver for tds2012, in fact this one is for LabVIEW "7.1"... :-P)
    TDS2012 and my computer is connected through HPIB(GPIB) and it is shown on the MAX (a GPIB instrument as well as an IVI hardware asset)
    I've tried GPIB connection but it gives me asynchronous signals...
    Is it possible to get 2 signals at the same time with LabVIEW 7.0(not 7.1 or higher) by any means?
    What in the earth is the "Config Server" in this case?
    I don't need to sticking to IVI and any method to achieve my goal will be welcome.
    Could anyone give me the hint for this problem, plz?

    I think your problem is that the instrument specific driver is version 7.1 and you are using the class driver with 7.0. You can create your own 7.0 driver by downloading the LabWindows driver and using the Import CVI Instrument Driver under the Tools>Instrumentation menu.
    Since you don't seem to have a good reason to use IVI, why don't you try the native LabVIEW driver at http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E9139659CE034080020E748.... I believe you have all of the functions to setup each channel and then when you trigger the scope, both channels will be captured. You would then transfer each waveform separately. The data is always read sequentially but that's not important as long as both channels are triggered at the same time.

  • 16 channels of audio recording at the same time with a MAC BOOK?

    Hi,
    I want to know how many channels of audio I can record at the same-time with a MAC BOOK (2.16GHz Intel Core 2 Duo, 1GB memory 120GB hard drive, Double-layer SuperDrive), firewire audio device and Logic Pro 8?
    You see I am aiming to record a live gig and I want to come into a firewire recording interface with 16 channels of audio all at the same time (24-bit, 44Khz) Does anyone know if this is possible? Or am I looking for trouble? No plug-ins will be used just record straight in. Anyone have some experience with this?
    Thanks.

    Ok, like this:
    Macbook - FW Port - FW Cable -In- MOTU Traveler -Out- External Harddrive.
    Firewire is capable of chaining units.
    Also plugged into your motu traveler will be an optical cable coming from the ADA.
    This will carry the 8 channels of audio it outputs.
    Also another good thing to do is to also have an optical cable FROM the optical output of your Traveler into the Behringer's input.
    That way you can sync the Behringer's digital clock to that of the Traveler, giving you a slightly better sounding signal that if you were to sync the traveler to the Behringer. This is simply because the traveler has a better quality digital clock than the Behringer unit so it's best to use that. To do this you just select "Adat input" on the back of the Behringer, and leave the Travelers sync to "Internal Clock". It is only a very very slight difference and you may not be able to notice the difference but for the cost of an optical cable it's worth doing.
    It will all make a lot more sense when you have the two units and the harddrive all plugged in.

  • Can i run two widgets at the same time on the same page?

    Can i run two widgets at the same time on the same page?
    Hi
    I have created and published 4 free ibooks and i would to run two widgets
    - a countdown clock
    - a review test
    at the same time on the page. Can i do that?
    Thanks in advance
    Haris

    thanks for your answer. Yes indeed HTML widgets run only full screen (snif snif). I consider this as a "distinguishing treatment".
    One solution  i read !!!!! was to create through keynote a countdown clock, to export to quicktime move and to imported at iBA predefined widgets. of course this is not the solution i need.
    So, in order to have at the same widget and run together a count down clock and a preview test (20 questions)  i must
    1)"hack" the preview widget and insert a countdown clock
    2) create a preview test using iAD.....
    thanks again
    haris

Maybe you are looking for

  • RAID 5 array. 2 arrays (/) and (/home) - asks about this

    Hello pals. On wiki, we'have that it's necessary create the array with mdadm, after assemble, and after installs arch like anyother disk system, just add while in chroot "mdadm_udev" and run "mkinitcpio -p linux" My question, however, is: In a first

  • Burn in my Imac 24" screen

    Hi, As the title say's, I got a screen burn. The problem is that I got it even if my screensaver activate after 5 mins of inactivity & the screen shut 5 mins after... I tried the trick of the white screensaver but no result.... My Imac is like 8 mont

  • Audition CS6 not support file name written in Arabic language

    dear support manager i have audition CS6 Version 5.0 Build 708 i have issue with Arabic language it not support   file name written an arabic language please help me argent in arabic language i have license for 10 user  i spent 3000$ for new audition

  • DeployJava.js update JAR versions

    Hello, I am using deployJava.js to deploy my applet. It works great and correctly caches the applet locally on the users machine. However, when I want to update the applet server-side, it does not detect that the file has changed and the client does

  • Doubts regarding cache

    Hi Gurus, Please help me to understand the follwoings:- a)Although I have created and saved ibots successfully and can see them in active ibots session,but somehow cache is not getting seeded and I can't see any records under manage cache.Please help