Skip to content

Commit 600db3f

Browse files
author
Dennis Sheirer
committed
#1998 P25 Traffic Channel Manager error ConcurrentModification on Allocated Channels Map, introduced in #1996
1 parent 161595e commit 600db3f

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
import java.util.concurrent.ConcurrentHashMap;
7171
import java.util.concurrent.LinkedTransferQueue;
7272
import java.util.concurrent.locks.ReentrantLock;
73-
import java.util.function.BiConsumer;
7473
import org.slf4j.Logger;
7574
import org.slf4j.LoggerFactory;
7675

@@ -171,23 +170,21 @@ protected void processControlFrequencyUpdate(long previous, long current, Channe
171170
try
172171
{
173172
//Shutdown all existing traffic channels and clear the maps.
174-
mAllocatedTrafficChannelMap.forEach(new BiConsumer<Long, Channel>()
173+
List<Channel> trafficChannelsToDisable = new ArrayList<>(mAllocatedTrafficChannelMap.values());
174+
mAllocatedTrafficChannelMap.clear();
175+
176+
for(Channel channel : trafficChannelsToDisable)
175177
{
176-
@Override
177-
public void accept(Long aLong, Channel channel)
178+
if(!parentChannel.equals(channel))
178179
{
179-
if(!parentChannel.equals(channel))
180-
{
181-
broadcast(new ChannelEvent(channel, Event.REQUEST_DISABLE));
182-
}
180+
broadcast(new ChannelEvent(channel, Event.REQUEST_DISABLE));
183181
}
184-
});
182+
}
185183

186-
mAllocatedTrafficChannelMap.clear();
187184
mTS1ChannelGrantEventMap.clear();
188185
mTS2ChannelGrantEventMap.clear();
189186

190-
//Store the control channel in the allocated channel map so that we don't allocate a traffic channel against it
187+
//Store the current control channel in the allocated channel map so that we don't allocate a traffic channel against it
191188
mAllocatedTrafficChannelMap.put(current, parentChannel);
192189
}
193190
finally

0 commit comments

Comments
 (0)