Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
public class BaseHandler extends Handler {
private volatile boolean disabled;
private volatile boolean handling;
private ConcurrentHashMap<Message, Boolean> messageQueue = new ConcurrentHashMap();

public Set<Message> getMessageQueue() {
return messageQueue.keySet();
}

public BaseHandler() {
}
Expand Down Expand Up @@ -50,9 +45,6 @@ public final void handleMessage(Message msg) {
}
handling = true;
try {
if (msg != null) {
messageQueue.remove(msg);
}
if (msg != null && msg.what == -1 && msg.obj instanceof CountDownLatch) {
((CountDownLatch) msg.obj).countDown();
} else {
Expand All @@ -78,22 +70,9 @@ public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
if (InternalListenerManager.isEnabled()) {
InternalListenerManager.getListener().onThreadMessage(getClass().getName(), msg, false);
}
if (msg != null) {
messageQueue.put(msg, true);
}
return super.sendMessageAtTime(msg, uptimeMillis);
}

public void removeMessage(int what) {
Set<Message> messages = messageQueue.keySet();
for (Message message : messages) {
if (message.what == what) {
messageQueue.remove(message);
}
}
super.removeMessages(what);
}

//Override this in order to handle messages
public void handleMessageImpl(Message msg) {
}
Expand Down
14 changes: 0 additions & 14 deletions testutils/src/main/java/com/mparticle/AccessUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ public static void reset(Context context, boolean deleteDatabase, boolean switch
MParticle.reset(context, deleteDatabase, switchingWorkspaces);
}

/**
* This is a way less than ideal implementation, but I think the insight is very important.
*
* This method returns an ordered list of the pending Messages in the UploadHandler queue. This
* gives us the ability to test the UploadHandler's true "state" when looking closely at how
* our Upload loop is performing
*
* @return
*/
@RequiresApi(api = Build.VERSION_CODES.M)
public static Set<Message> getUploadHandlerMessageQueue() {
return getMessageManager().mUploadHandler.getMessageQueue();
}

public static MessageManager getMessageManager() {
return MParticle.getInstance().mMessageManager;
}
Expand Down
Loading