gpt4 book ai didi

org.apache.catalina.tribes.io.XByteBuffer.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 16:47:40 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.catalina.tribes.io.XByteBuffer.<init>()方法的一些代码示例,展示了XByteBuffer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XByteBuffer.<init>()方法的具体详情如下:
包路径:org.apache.catalina.tribes.io.XByteBuffer
类名称:XByteBuffer
方法名:<init>

XByteBuffer.<init>介绍

[英]Constructs a new XByteBuffer
[中]构造一个新的XByteBuffer

代码示例

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

public ObjectReader(int packetSize) {
  this.buffer = new XByteBuffer(packetSize, true);
}
/**

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

/**
 * Creates an <code>ObjectReader</code> for a TCP socket
 * @param socket Socket
 */
public ObjectReader(Socket socket) {
  try{
    this.buffer = new XByteBuffer(socket.getReceiveBufferSize(), true);
  }catch ( IOException x ) {
    //unable to get buffer size
    log.warn("Unable to retrieve the socket receiver buffer size, setting to default 43800 bytes.");
    this.buffer = new XByteBuffer(43800,true);
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Creates an <code>ObjectReader</code> for a TCP socket
 * @param socket Socket
 */
public ObjectReader(Socket socket) {
  try{
    this.buffer = new XByteBuffer(socket.getReceiveBufferSize(), true);
  }catch ( IOException x ) {
    //unable to get buffer size
    log.warn("Unable to retrieve the socket receiver buffer size, setting to default 43800 bytes.");
    this.buffer = new XByteBuffer(43800,true);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-tribes

/**
 * Creates an <code>ObjectReader</code> for a TCP socket
 * @param socket Socket
 */
public ObjectReader(Socket socket) {
  try{
    this.buffer = new XByteBuffer(socket.getReceiveBufferSize(), true);
  }catch ( IOException x ) {
    //unable to get buffer size
    log.warn(sm.getString("objectReader.retrieveFailed.socketReceiverBufferSize"));
    this.buffer = new XByteBuffer(43800,true);
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-tribes

public CoordinationMessage(Member leader,
              Member source,
              Member[] view,
              UniqueId id,
              byte[] type) {
  this.buf = new XByteBuffer(4096,false);
  this.leader = leader;
  this.source = source;
  this.view = view;
  this.id = id;
  this.type = type;
  this.write();
}

代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

public XByteBuffer getBuffer(int minSize, boolean discard) {
  if ( pool != null ) return pool.getBuffer(minSize, discard);
  else return new XByteBuffer(minSize,discard);
}

代码示例来源:origin: codefollower/Tomcat-Research

public XByteBuffer getBuffer(int minSize, boolean discard) {
  if ( pool != null ) return pool.getBuffer(minSize, discard);
  else return new XByteBuffer(minSize,discard);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

public CoordinationMessage(MemberImpl leader,
              MemberImpl source, 
              MemberImpl[] view,
              UniqueId id,
              byte[] type) {
  this.buf = new XByteBuffer(4096,false);
  this.leader = leader;
  this.source = source;
  this.view = view;
  this.id = id;
  this.type = type;
  this.write();
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public XByteBuffer getBuffer(int minSize, boolean discard) {
  XByteBuffer buffer = queue.poll();
  if ( buffer != null ) size.addAndGet(-buffer.getCapacity());
  if ( buffer == null ) buffer = new XByteBuffer(minSize,discard);
  else if ( buffer.getCapacity() <= minSize ) buffer.expand(minSize);
  buffer.setDiscard(discard);
  buffer.reset();
  return buffer;
}

代码示例来源:origin: org.apache.tomcat/tomcat-tribes

@Override
public XByteBuffer getBuffer(int minSize, boolean discard) {
  XByteBuffer buffer = queue.poll();
  if ( buffer != null ) size.addAndGet(-buffer.getCapacity());
  if ( buffer == null ) buffer = new XByteBuffer(minSize,discard);
  else if ( buffer.getCapacity() <= minSize ) buffer.expand(minSize);
  buffer.setDiscard(discard);
  buffer.reset();
  return buffer;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

@Override
public XByteBuffer getBuffer(int minSize, boolean discard) {
  XByteBuffer buffer = queue.poll();
  if ( buffer != null ) size.addAndGet(-buffer.getCapacity());
  if ( buffer == null ) buffer = new XByteBuffer(minSize,discard);
  else if ( buffer.getCapacity() <= minSize ) buffer.expand(minSize);
  buffer.setDiscard(discard);
  buffer.reset();
  return buffer;
}

代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

public XByteBuffer getBuffer(int minSize, boolean discard) {
  XByteBuffer buffer = (XByteBuffer)queue.poll();
  if ( buffer != null ) size.addAndGet(-buffer.getCapacity());
  if ( buffer == null ) buffer = new XByteBuffer(minSize,discard);
  else if ( buffer.getCapacity() <= minSize ) buffer.expand(minSize);
  buffer.setDiscard(discard);
  buffer.reset();
  return buffer;
}

代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

public synchronized XByteBuffer getBuffer(int minSize, boolean discard) {
  XByteBuffer buffer = (XByteBuffer)(queue.size()>0?queue.remove(0):null);
  if ( buffer != null ) addAndGet(-buffer.getCapacity());
  if ( buffer == null ) buffer = new XByteBuffer(minSize,discard);
  else if ( buffer.getCapacity() <= minSize ) buffer.expand(minSize);
  buffer.setDiscard(discard);
  buffer.reset();
  return buffer;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

public ChannelMessage assemble() {
  if ( !complete() ) throw new IllegalStateException("Fragments are missing.");
  int buffersize = 0;
  for (int i=0; i<frags.length; i++ ) buffersize += frags[i].getLength();
  XByteBuffer buf = new XByteBuffer(buffersize,false);
  msg.setMessage(buf);
  for ( int i=0; i<frags.length; i++ ) {
    msg.getMessage().append(frags[i].getBytesDirect(),0,frags[i].getLength());
  }
  return msg;
}

代码示例来源:origin: codefollower/Tomcat-Research

public ChannelMessage assemble() {
  if ( !complete() ) throw new IllegalStateException("Fragments are missing.");
  int buffersize = 0;
  for (int i=0; i<frags.length; i++ ) buffersize += frags[i].getLength();
  XByteBuffer buf = new XByteBuffer(buffersize,false);
  msg.setMessage(buf);
  for ( int i=0; i<frags.length; i++ ) {
    msg.getMessage().append(frags[i].getBytesDirect(),0,frags[i].getLength());
  }
  return msg;
}

代码示例来源:origin: org.apache.catalina.springsource/com.springsource.org.apache.catalina.tribes.springsource

public ChannelMessage assemble() {
  if ( !complete() ) throw new IllegalStateException("Fragments are missing.");
  int buffersize = 0;
  for (int i=0; i<frags.length; i++ ) buffersize += frags[i].getLength();
  XByteBuffer buf = new XByteBuffer(buffersize,false);
  msg.setMessage(buf);
  for ( int i=0; i<frags.length; i++ ) {
    msg.getMessage().append(frags[i].getBytesDirect(),0,frags[i].getLength());
  }
  return msg;
}

代码示例来源:origin: org.apache.tomcat/tomcat-tribes

public ChannelMessage assemble() {
  if ( !complete() ) throw new IllegalStateException(sm.getString("fragmentationInterceptor.fragments.missing"));
  int buffersize = 0;
  for (int i=0; i<frags.length; i++ ) buffersize += frags[i].getLength();
  XByteBuffer buf = new XByteBuffer(buffersize,false);
  msg.setMessage(buf);
  for ( int i=0; i<frags.length; i++ ) {
    msg.getMessage().append(frags[i].getBytesDirect(),0,frags[i].getLength());
  }
  return msg;
}

代码示例来源:origin: org.apache.tomcat/tomcat-tribes

protected void sendMemberMessage(Member[] members, byte[] message) throws ChannelException {
    if ( members == null || members.length == 0 ) return;
    ChannelData data = new ChannelData(true);
    data.setAddress(getLocalMember(false));
    data.setTimestamp(System.currentTimeMillis());
    data.setOptions(getOptionFlag());
    data.setMessage(new XByteBuffer(message, false));
    super.sendMessage(members, data, null);
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/tribes

protected void sendPingMessage(Member[] members) {
  if ( members == null || members.length == 0 ) return;
  ChannelData data = new ChannelData(true);//generates a unique Id
  data.setAddress(getLocalMember(false));
  data.setTimestamp(System.currentTimeMillis());
  data.setOptions(getOptionFlag());
  data.setMessage(new XByteBuffer(TCP_PING_DATA, false));
  try {
    super.sendMessage(members, data, null);
  }catch (ChannelException x) {
    log.warn("Unable to send TCP ping.",x);
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

protected void sendPingMessage(Member[] members) {
  if ( members == null || members.length == 0 ) return;
  ChannelData data = new ChannelData(true);//generates a unique Id
  data.setAddress(getLocalMember(false));
  data.setTimestamp(System.currentTimeMillis());
  data.setOptions(getOptionFlag());
  data.setMessage(new XByteBuffer(TCP_PING_DATA, false));
  try {
    super.sendMessage(members, data, null);
  }catch (ChannelException x) {
    log.warn("Unable to send TCP ping.",x);
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com