6896157: unsynchronized hashmap in com.sun.corba.se.impl.transport.SelectorImpl.createReaderThread
Reviewed-by: asaha
This commit is contained in:
parent
7720bcf09c
commit
d22fa91e86
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,6 +32,7 @@ import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ -66,7 +67,7 @@ public class SelectorImpl
|
||||
private List deferredRegistrations;
|
||||
private List interestOpsList;
|
||||
private HashMap listenerThreads;
|
||||
private HashMap readerThreads;
|
||||
private Map readerThreads;
|
||||
private boolean selectorStarted;
|
||||
private boolean closed;
|
||||
private ORBUtilSystemException wrapper ;
|
||||
@ -81,7 +82,7 @@ public class SelectorImpl
|
||||
deferredRegistrations = new ArrayList();
|
||||
interestOpsList = new ArrayList();
|
||||
listenerThreads = new HashMap();
|
||||
readerThreads = new HashMap();
|
||||
readerThreads = java.util.Collections.synchronizedMap(new HashMap());
|
||||
closed = false;
|
||||
wrapper = ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT);
|
||||
}
|
||||
@ -178,8 +179,13 @@ public class SelectorImpl
|
||||
}
|
||||
|
||||
if (eventHandler.shouldUseSelectThreadToWait()) {
|
||||
SelectionKey selectionKey = eventHandler.getSelectionKey();
|
||||
selectionKey.cancel();
|
||||
SelectionKey selectionKey ;
|
||||
synchronized(deferredRegistrations) {
|
||||
selectionKey = eventHandler.getSelectionKey();
|
||||
}
|
||||
if (selectionKey != null) {
|
||||
selectionKey.cancel();
|
||||
}
|
||||
selector.wakeup();
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user