当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQBuffer.byteBuf方法代码示例

本文整理汇总了Java中org.apache.activemq.artemis.api.core.ActiveMQBuffer.byteBuf方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQBuffer.byteBuf方法的具体用法?Java ActiveMQBuffer.byteBuf怎么用?Java ActiveMQBuffer.byteBuf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.artemis.api.core.ActiveMQBuffer的用法示例。


在下文中一共展示了ActiveMQBuffer.byteBuf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
@Override
public void write(ActiveMQBuffer bytes, boolean sync, IOCallback callback) throws IOException {
   if (callback == null) {
      throw new NullPointerException("callback parameter need to be set");
   }
   checkIsOpen(callback);
   try {
      final ByteBuf byteBuf = bytes.byteBuf();
      final int writerIndex = byteBuf.writerIndex();
      final int readerIndex = byteBuf.readerIndex();
      final int readableBytes = writerIndex - readerIndex;
      if (readableBytes > 0) {
         this.mappedFile.write(byteBuf, readerIndex, readableBytes);
         if (factory.isDatasync() && sync) {
            this.mappedFile.force();
         }
      }
      callback.done();
   } catch (IOException e) {
      if (this.criticalErrorListener != null) {
         this.criticalErrorListener.onIOException(new ActiveMQIOErrorException(e.getMessage(), e), e.getMessage(), this);
      }
      callback.onError(ActiveMQExceptionType.IO_ERROR.getCode(), e.getMessage());
      throw e;
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:MappedSequentialFile.java

示例2: writeInEventLoop

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
private void writeInEventLoop(ActiveMQBuffer buffer,
                              final boolean flush,
                              final boolean batched,
                              final ChannelFutureListener futureListener) {
   //no need to lock because the Netty's channel is thread-safe
   //and the order of write is ensured by the order of the write calls
   final ChannelPromise promise;
   if (futureListener != null) {
      promise = channel.newPromise();
   } else {
      promise = channel.voidPromise();
   }
   final ChannelFuture future;
   final ByteBuf bytes = buffer.byteBuf();
   final int readableBytes = bytes.readableBytes();
   final int writeBatchSize = this.batchLimit;
   if (this.batchingEnabled && batched && !flush && readableBytes < writeBatchSize) {
      future = writeBatch(bytes, readableBytes, promise);
   } else {
      future = channel.writeAndFlush(bytes, promise);
   }
   if (futureListener != null) {
      future.addListener(futureListener);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:NettyConnection.java

示例3: encode

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public void encode(final ActiveMQBuffer buffer1) {
   super.encodeHeadersAndProperties(buffer1.byteBuf());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:4,代码来源:LargeServerMessageImpl.java

示例4: decode

import org.apache.activemq.artemis.api.core.ActiveMQBuffer; //导入方法依赖的package包/类
public void decode(final ActiveMQBuffer buffer1) {
   file = null;

   super.decodeHeadersAndProperties(buffer1.byteBuf());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:LargeServerMessageImpl.java


注:本文中的org.apache.activemq.artemis.api.core.ActiveMQBuffer.byteBuf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。