com.ullink.slack.simpleslackapi.impl.SlackMessageHandleImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleslackapi-lib Show documentation
Show all versions of simpleslackapi-lib Show documentation
A simple API to build bot running on Slack
The newest version!
package com.ullink.slack.simpleslackapi.impl;
import java.util.concurrent.TimeUnit;
import com.ullink.slack.simpleslackapi.SlackMessageHandle;
import com.ullink.slack.simpleslackapi.replies.SlackReply;
class SlackMessageHandleImpl implements SlackMessageHandle
{
private long messageId;
private volatile T slackReply;
public SlackMessageHandleImpl(long messageId)
{
this.messageId = messageId;
}
@Override
public long getMessageId()
{
return messageId;
}
@Override
public T getReply()
{
return slackReply;
}
void setReply(T slackReply)
{
this.slackReply = slackReply;
}
@Override
public boolean isAcked()
{
return false;
}
@Override
public void waitForReply(long timeout, TimeUnit unit)
{
long nanoStart = System.nanoTime();
while ((System.nanoTime() - nanoStart) < unit.toNanos(timeout) && slackReply == null)
{
try
{
Thread.sleep(1);
}
catch (InterruptedException e)
{
return;
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy