File tree Expand file tree Collapse file tree
pvAccessJava/src/org/epics/pvaccess/server/impl/remote Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ public Destroyable getRequest(int id) {
158158
159159 }
160160
161- public Destroyable [] getRequests () {
161+ public synchronized Destroyable [] getRequests () {
162162
163163 Destroyable [] reqs = new Destroyable [requests .size ()];
164164 requests .values ().toArray (reqs );
Original file line number Diff line number Diff line change @@ -108,12 +108,13 @@ private void destroyAllChannels() {
108108
109109 context .getLogger ().fine ("Transport to " + socketAddress + " still has " + channels .size () + " channel(s) active and closing..." );
110110
111-
112- for (ServerChannel serverChannel : channels .values ()) {
113- serverChannel .destroy ();
114- }
115-
116- channels .clear ();
111+ synchronized (channels ) {
112+ for (ServerChannel serverChannel : channels .values ()) {
113+ serverChannel .destroy ();
114+ }
115+
116+ channels .clear ();
117+ }
117118 }
118119
119120 /**
@@ -122,13 +123,13 @@ private void destroyAllChannels() {
122123 */
123124 public int preallocateChannelSID ()
124125 {
125-
126+ synchronized ( channels ) {
126127 // search first free (theoretically possible loop of death)
127128 int sid = lastChannelSID .incrementAndGet ();
128129 while (channels .containsKey (sid ))
129130 sid = lastChannelSID .incrementAndGet ();
130131 return sid ;
131-
132+ }
132133 }
133134
134135 /**
You can’t perform that action at this time.
0 commit comments