putb(T msg, final long timeoutMillis)
See original GitHub issueHi,
I read the MailBox.java and have a question. Why the method putb(T msg, final long timeoutMillis)
not reput the msg when the mailbox is not full. But the method put(T msg, int timeoutMillis)
reput the msg in a loop.
Thanks.
/**
* put a non-null message in the mailbox, and block the calling thread for timeoutMillis
* if the mailbox is full.
*/
public void putb(T msg, final long timeoutMillis) {
BlockingSubscriber evs = new BlockingSubscriber();
if (!put(msg, evs)) {
evs.blockingWait(timeoutMillis);
}
if (!evs.eventRcvd) {
removeSpaceAvailableListener(evs);
}
}
/**
* put a non-null message in the mailbox, and pause the calling task for timeoutMillis
* if the mailbox is full.
*/
public boolean put(T msg, int timeoutMillis) throws Pausable {
final Task t = Task.getCurrentTask();
long begin = System.currentTimeMillis();
while (!put(msg, t)) {
TimerTask tt = new TimerTask() {
public void run() {
Mailbox.this.removeSpaceAvailableListener(t);
t.onEvent(Mailbox.this, timedOut);
}
};
Task.timer.schedule(tt, timeoutMillis);
Task.pause(this);
removeSpaceAvailableListener(t);
if (System.currentTimeMillis() - begin >= timeoutMillis) {
return false;
}
}
return true;
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Issues · kilim/kilim - GitHub
Lightweight threads for Java, with message passing, nio, http and scheduling support. - Issues · kilim/kilim. ... Cell.putb(T msg, final long timeoutMillis).
Read more >services/java/com/android/server/power ... - Google Git
Message : Sent when a user activity timeout occurs to update the power state. ... Timestamp of the last time the device was...
Read more >java.util.concurrent.ArrayBlockingQueue.poll java code ...
Retrieves and removes buffer at the head of this queue, * waiting up to the specified wait time if necessary for an element...
Read more >Failed to construct kafka producer with Springboot
Had a similar issue from my end I imported the wrong JsonSerializer class. Changed to this import ...
Read more >API Proxy timeout - Google Cloud Community
Cloud customers, who can't modify the Edge timeouts, can also configure an API proxy timeout, as long as the timeout is shorter than...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this is fixed (for both putb and getb) in kilim 2.0
@CurryGaifan thanks for noticing the inconsistency, and @zy416548283 thanks for explaining the significance to me
@kilim @nqzero Here, we has similar question lastly.
But now, putb will not reput the msg into the mailbox; In some situations, this behavior may be dangerous.