27 |
|
* @summary Vector's lastIndexOf(Object) was lacking synchronization |
28 |
|
* @author Konstantin Kladko |
29 |
|
*/ |
30 |
< |
import java.util.*; |
30 |
> |
|
31 |
> |
import java.util.Vector; |
32 |
|
|
33 |
|
public class SyncLastIndexOf { |
34 |
|
|
37 |
|
static class RemovingThread extends Thread { |
38 |
|
|
39 |
|
public void run() { |
40 |
< |
synchronized(v) { |
40 |
> |
synchronized (v) { |
41 |
|
try { |
42 |
|
sleep(200); |
43 |
|
} catch (InterruptedException e) { |
47 |
|
} |
48 |
|
} |
49 |
|
|
50 |
< |
public static void main(String args[]) { |
50 |
> |
public static void main(String[] args) { |
51 |
|
Integer x = new Integer(1); |
52 |
|
v.addElement(x); |
53 |
|
new RemovingThread().start(); |