Differences in collection implementations between 32-bit and 64-bit, any problems we need to worry about?

We have a 32-bit client process that communicates through CORBA with an outdated server application running on a remote machine. It has been working well and reliably for about 12 years.

We need to (temporarily) switch our client process to 64-bit in order to get more memory (waiting for the inevitable rewriting) and almost immediately encountered some problems with the remote application . The process crashed repeatedly. Initially, it made no sense how a remote application could be sensitive to a client application VM if it uses an agnostic platform protocol such as CORBA?

After several days of investigation, we found that the failure of the remote process has nothing to do with the client VM, but does not seem to match the order in which the parameters were sent.

We send an array of the requested result types to the server, this is initially taken from the configuration and placed in the HashSet, converting to the array at the last minute. The server application seems to be sensitive to the order of the requested result types.

eg. If we send PV (0), DELTA (1), NPV (2), GAMMA (3), this is normal. If we send GAMMA (3), PV (0), DELTA (1), NPV (2), the remote application will work. This just seems like a strange mistake in a remote application that has never been exposed before, because the order has always been numerical (by accident).

This is a transition to 64-bit, which seems to have changed the situation; the 64-bit version creates a different order of elements from the HashSet. This is not what I expected, but I suspect that HashCodes are deterministic only on the platform.

Ensuring that the array is sorted before sending resolved the issue. Switching to a TreeSet would also help, but in the back of the library.

Are there any other oddities between 32bit and 64bit that we need to worry about? So far, I have been impressed with how simple the conversion was, there were no other code changes at all.

We are currently in Java 6, and the transition to Java 8 is inevitable. Can we expect similar issues when upgrading to Java 8?

+4
source share
1

, - Java . - 32- 64- JVM; .

Map , , , , HashMap. , , , . , , , LinkedHashMap ( ) TreeMap ( , , ).

, (, 64- JVM 32- JVM ), HashMap -. , , JVM (, Java 6 update X Java 6 Y), .

, , . Java-, Java, , , - Java.

Oracle JDK 8, , Java 8 , Java API, .

Java 6 Java 8 ( , Java 6 ), .

+7

All Articles