本文整理汇总了Java中com.google.bitcoin.net.MessageWriteTarget类的典型用法代码示例。如果您正苦于以下问题:Java MessageWriteTarget类的具体用法?Java MessageWriteTarget怎么用?Java MessageWriteTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageWriteTarget类属于com.google.bitcoin.net包,在下文中一共展示了MessageWriteTarget类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWriteTarget
import com.google.bitcoin.net.MessageWriteTarget; //导入依赖的package包/类
/**
* Sets the {@link MessageWriteTarget} used to write messages to the peer. This should almost never be called, it is
* called automatically by {@link com.google.bitcoin.net.NioClient} or
* {@link com.google.bitcoin.net.NioClientManager} once the socket finishes initialization.
*/
@Override
public void setWriteTarget(MessageWriteTarget writeTarget) {
checkArgument(writeTarget != null);
lock.lock();
boolean closeNow = false;
try {
checkArgument(this.writeTarget == null);
closeNow = closePending;
this.writeTarget = writeTarget;
} finally {
lock.unlock();
}
if (closeNow)
writeTarget.closeConnection();
}