Mark Thomas wrote:
Omega wrote:
How are you getting your wrong impressions of the values? - you don't
show any output, or say how (you think) you know what's going on.
Mark
I know whats going on like this:
class A {
private int id;
private static long sequence = 1;
public A(){
id = sequence;
sequence++;
System.out.println("id = "+id+" seq = "+sequence);
}
}
I cant post whole code here, because it's rather huge, there's whole gui,
plus I write this programm for a company and can't give it to everybody.
I can tell what's going on.
I have a program, in the begining there's one object of class B (the one
that holds list of A). When I create objects of class A, they all have
good id's that is: 1,2,3.... Then I can create second object of class B.
And then sequence is changed to 0. When I create objects A they have ids
0,1,2,... There are no threads in the programm, nothing unusual is going
on.
You said UI - then you usually got at least two threads. Why don't you
Btw, your sequence generator generates longs but your id is just int.
That's most likely a problem in itself.