Skip to content

Commit

Permalink
Use simpler collection, just Queue is needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
svatoun committed May 5, 2020
1 parent 980841c commit a048134
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions java/src/jmri/jmrix/lenz/FeedbackItem.java
@@ -1,7 +1,6 @@
package jmri.jmrix.lenz;

import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import jmri.Turnout;

/**
Expand Down Expand Up @@ -157,7 +156,6 @@ public Boolean getEncoderStatus(int sensorNumber) {
* item. Returns {@code null} for non-accessory feedbacks.
* @return instance for the paired accessory, or {@code null}.
*/
@Nullable
public FeedbackItem pairedAccessoryItem() {
if (!isAccessory()) {
return null;
Expand Down
11 changes: 6 additions & 5 deletions java/src/jmri/jmrix/lenz/XNetTurnout.java
@@ -1,8 +1,8 @@
package jmri.jmrix.lenz;

import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;
import jmri.implementation.AbstractTurnout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -134,7 +134,7 @@ public XNetTurnout(String prefix, int pNumber, XNetTrafficController controller)
_prefix = prefix;
mNumber = pNumber;

requestList = new ArrayDeque<>();
requestList = new LinkedList<>();

/* Add additiona feedback types information */
_validFeedbackTypes |= MONITORING | EXACT | SIGNAL;
Expand Down Expand Up @@ -655,7 +655,7 @@ public void propertyChange(java.beans.PropertyChangeEvent event) {

// A queue to hold outstanding messages
@GuardedBy("this")
protected final Deque<RequestMessage> requestList;
protected final Queue<RequestMessage> requestList;

/**
* Send message from queue.
Expand Down Expand Up @@ -687,7 +687,8 @@ protected synchronized void queueMessage(XNetMessage m, int s, XNetListener l) {
log.debug("adding message {} to message queue. Current Internal State {}",m,internalState);
// put the message in the queue
RequestMessage msg = new RequestMessage(m, s, l);
requestList.offer(msg);
// the queue is unbounded; can't throw exceptions
requestList.add(msg);
// if the state is idle, trigger the message send
if (internalState == IDLE ) {
sendQueuedMessage();
Expand Down

0 comments on commit a048134

Please sign in to comment.