public void resendAsNewMessageDelayed(long msgId, int delay) { for (SchedullerPackage schedullerPackage : messages.values().toArray(new SchedullerPackage[0])) { if (schedullerPackage.relatedMessageIds.contains(msgId)) { schedullerPackage.idGenerationTime = 0; schedullerPackage.dependMessageId = 0; schedullerPackage.messageId = 0; schedullerPackage.seqNo = 0; schedullerPackage.state = STATE_QUEUED; schedullerPackage.scheduleTime = getCurrentTime() + delay; Logger.d(TAG, "Resending as new #" + schedullerPackage.id); } } }
public int postMessageDelayed( TLObject object, boolean isRpc, long timeout, int delay, int contextId, boolean highPrioroty) { int id = messagesIds.incrementAndGet(); SchedullerPackage schedullerPackage = new SchedullerPackage(id); schedullerPackage.object = object; schedullerPackage.addTime = getCurrentTime(); schedullerPackage.scheduleTime = schedullerPackage.addTime + delay; schedullerPackage.expiresTime = schedullerPackage.scheduleTime + timeout; schedullerPackage.ttlTime = schedullerPackage.scheduleTime + timeout * 2; schedullerPackage.isRpc = isRpc; schedullerPackage.queuedToChannel = contextId; schedullerPackage.priority = highPrioroty ? PRIORITY_HIGH : PRIORITY_NORMAL; schedullerPackage.isDepend = highPrioroty; schedullerPackage.supportTag = object.toString(); messages.put(id, schedullerPackage); return id; }