gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-20 17:11:40 26 4
gpt4 key购买 nike

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

XByteBuffer.getDataPackageLength介绍

暂无

代码示例

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

public static byte[] createDataPackage(byte[] data, int doff, int dlength, byte[] buffer, int bufoff) {
  if ( (buffer.length-bufoff) > getDataPackageLength(dlength) ) {
    throw new ArrayIndexOutOfBoundsException("Unable to create data package, buffer is too small.");
  }
  System.arraycopy(START_DATA, 0, buffer, bufoff, START_DATA.length);
  toBytes(data.length,buffer, bufoff+START_DATA.length);
  System.arraycopy(data, doff, buffer, bufoff+START_DATA.length + 4, dlength);
  System.arraycopy(END_DATA, 0, buffer, bufoff+START_DATA.length + 4 + data.length, END_DATA.length);
  return buffer;
}

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

public static byte[] createDataPackage(byte[] data, int doff, int dlength, byte[] buffer, int bufoff) {
  if ( (buffer.length-bufoff) > getDataPackageLength(dlength) ) {
    throw new ArrayIndexOutOfBoundsException("Unable to create data package, buffer is too small.");
  }
  System.arraycopy(START_DATA, 0, buffer, bufoff, START_DATA.length);
  toBytes(data.length,buffer, bufoff+START_DATA.length);
  System.arraycopy(data, doff, buffer, bufoff+START_DATA.length + 4, dlength);
  System.arraycopy(END_DATA, 0, buffer, bufoff+START_DATA.length + 4 + data.length, END_DATA.length);
  return buffer;
}

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

public static byte[] createDataPackage(byte[] data) {
  int length = getDataPackageLength(data.length);
  byte[] result = new byte[length];
  return createDataPackage(data,0,data.length,result,0);
}

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

public static byte[] createDataPackage(byte[] data) {
  int length = getDataPackageLength(data.length);
  byte[] result = new byte[length];
  return createDataPackage(data,0,data.length,result,0);
}

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

public static byte[] createDataPackage(byte[] data, int doff, int dlength, byte[] buffer, int bufoff) {
  if ( (buffer.length-bufoff) > getDataPackageLength(dlength) ) {
    throw new ArrayIndexOutOfBoundsException("Unable to create data package, buffer is too small.");
  }
  System.arraycopy(START_DATA, 0, buffer, bufoff, START_DATA.length);
  toBytes(data.length,buffer, bufoff+START_DATA.length);
  System.arraycopy(data, doff, buffer, bufoff+START_DATA.length + 4, dlength);
  System.arraycopy(END_DATA, 0, buffer, bufoff+START_DATA.length + 4 + data.length, END_DATA.length);
  return buffer;
}

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

public static byte[] createDataPackage(byte[] data) {
  int length = getDataPackageLength(data.length);
  byte[] result = new byte[length];
  return createDataPackage(data,0,data.length,result,0);
}

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

public static byte[] createDataPackage(byte[] data) {
  int length = getDataPackageLength(data.length);
  byte[] result = new byte[length];
  return createDataPackage(data,0,data.length,result,0);
}

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

public static byte[] createDataPackage(byte[] data, int doff, int dlength, byte[] buffer, int bufoff) {
  if ( (buffer.length-bufoff) > getDataPackageLength(dlength) ) {
    throw new ArrayIndexOutOfBoundsException(sm.getString("xByteBuffer.unableCreate"));
  }
  System.arraycopy(START_DATA, 0, buffer, bufoff, START_DATA.length);
  toBytes(data.length,buffer, bufoff+START_DATA.length);
  System.arraycopy(data, doff, buffer, bufoff+START_DATA.length + 4, dlength);
  System.arraycopy(END_DATA, 0, buffer, bufoff+START_DATA.length + 4 + data.length, END_DATA.length);
  return buffer;
}

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

@Override
public void messageReceived(ChannelMessage msg) {
  if ( rxStart == 0 ) rxStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  mbRx += bytes/(1024d*1024d);
  msgRxCnt.addAndGet(1);
  if ( msgRxCnt.get() % interval == 0 ) report(timeTx);
  super.messageReceived(msg);
}

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

@Override
public void messageReceived(ChannelMessage msg) {
  if ( rxStart == 0 ) rxStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  mbRx += bytes/(1024d*1024d);
  msgRxCnt.addAndGet(1);
  if ( msgRxCnt.get() % interval == 0 ) report(timeTx);
  super.messageReceived(msg);
  
}

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

@Override
public void messageReceived(ChannelMessage msg) {
  if ( rxStart == 0 ) rxStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  mbRx += bytes/(1024d*1024d);
  msgRxCnt.addAndGet(1);
  if ( msgRxCnt.get() % interval == 0 ) report(timeTx);
  super.messageReceived(msg);
}

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

public void messageReceived(ChannelMessage msg) {
  if ( rxStart == 0 ) rxStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  mbRx += ((double)bytes)/(1024d*1024d);
  msgRxCnt.addAndGet(1);
  if ( msgRxCnt.get() % interval == 0 ) report(timeTx);
  super.messageReceived(msg);
  
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
  if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  try {
    super.sendMessage(destination, msg, payload);
  }catch ( ChannelException x ) {
    msgTxErr.addAndGet(1);
    if ( access.get() == 1 ) access.addAndGet(-1);
    throw x;
  } 
  mbTx += (bytes*destination.length)/(1024d*1024d);
  mbAppTx += bytes/(1024d*1024d);
  if ( access.addAndGet(-1) == 0 ) {
    long stop = System.currentTimeMillis();
    timeTx += (stop - txStart) / 1000d;
    if ((msgTxCnt.get() / interval) >= lastCnt) {
      lastCnt++;
      report(timeTx);
    }
  }
  msgTxCnt.addAndGet(1);
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
  if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  try {
    super.sendMessage(destination, msg, payload);
  }catch ( ChannelException x ) {
    msgTxErr.addAndGet(1);
    if ( access.get() == 1 ) access.addAndGet(-1);
    throw x;
  }
  mbTx += (bytes*destination.length)/(1024d*1024d);
  mbAppTx += bytes/(1024d*1024d);
  if ( access.addAndGet(-1) == 0 ) {
    long stop = System.currentTimeMillis();
    timeTx += (stop - txStart) / 1000d;
    if ((msgTxCnt.get() / (double) interval) >= lastCnt) {
      lastCnt++;
      report(timeTx);
    }
  }
  msgTxCnt.addAndGet(1);
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
  if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  try {
    super.sendMessage(destination, msg, payload);
  }catch ( ChannelException x ) {
    msgTxErr.addAndGet(1);
    if ( access.get() == 1 ) access.addAndGet(-1);
    throw x;
  }
  mbTx += (bytes*destination.length)/(1024d*1024d);
  mbAppTx += bytes/(1024d*1024d);
  if ( access.addAndGet(-1) == 0 ) {
    long stop = System.currentTimeMillis();
    timeTx += (stop - txStart) / 1000d;
    if ((msgTxCnt.get() / interval) >= lastCnt) {
      lastCnt++;
      report(timeTx);
    }
  }
  msgTxCnt.addAndGet(1);
}

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

public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
  if ( access.addAndGet(1) == 1 ) txStart = System.currentTimeMillis();
  long bytes = XByteBuffer.getDataPackageLength(((ChannelData)msg).getDataPackageLength());
  try {
    super.sendMessage(destination, msg, payload);
  }catch ( ChannelException x ) {
    msgTxErr.addAndGet(1);
    access.addAndGet(-1);
    throw x;
  } 
  mbTx += ((double)(bytes*destination.length))/(1024d*1024d);
  mbAppTx += ((double)(bytes))/(1024d*1024d);
  if ( access.addAndGet(-1) == 0 ) {
    long stop = System.currentTimeMillis();
    timeTx += ( (double) (stop - txStart)) / 1000d;
    if ((msgTxCnt.get() / interval) >= lastCnt) {
      lastCnt++;
      report(timeTx);
    }
  }
  msgTxCnt.addAndGet(1);
}

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

/**
   * Creates a complete data package
   * @param cdata - the message data to be contained within the package
   * @return - a full package (header,size,data,footer)
   */
  public static byte[] createDataPackage(ChannelData cdata) {
//        return createDataPackage(cdata.getDataPackage());
    //avoid one extra byte array creation
    int dlength = cdata.getDataPackageLength();
    int length = getDataPackageLength(dlength);
    byte[] data = new byte[length];
    int offset = 0;
    System.arraycopy(START_DATA, 0, data, offset, START_DATA.length);
    offset += START_DATA.length;
    toBytes(dlength,data, START_DATA.length);
    offset += 4;
    cdata.getDataPackage(data,offset);
    offset += dlength;
    System.arraycopy(END_DATA, 0, data, offset, END_DATA.length);
    offset += END_DATA.length;
    return data;
  }

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

/**
   * Creates a complete data package
   * @param cdata - the message data to be contained within the package
   * @return - a full package (header,size,data,footer)
   */
  public static byte[] createDataPackage(ChannelData cdata) {
//        return createDataPackage(cdata.getDataPackage());
    //avoid one extra byte array creation
    int dlength = cdata.getDataPackageLength();
    int length = getDataPackageLength(dlength);
    byte[] data = new byte[length];
    int offset = 0;
    System.arraycopy(START_DATA, 0, data, offset, START_DATA.length);
    offset += START_DATA.length;
    toBytes(dlength,data, START_DATA.length);
    offset += 4;
    cdata.getDataPackage(data,offset);
    offset += dlength;
    System.arraycopy(END_DATA, 0, data, offset, END_DATA.length);
    offset += END_DATA.length;
    return data;
  }

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

/**
   * Creates a complete data package
   * @param cdata - the message data to be contained within the package
   * @return - a full package (header,size,data,footer)
   */
  public static byte[] createDataPackage(ChannelData cdata) {
//        return createDataPackage(cdata.getDataPackage());
    //avoid one extra byte array creation
    int dlength = cdata.getDataPackageLength();
    int length = getDataPackageLength(dlength);
    byte[] data = new byte[length];
    int offset = 0;
    System.arraycopy(START_DATA, 0, data, offset, START_DATA.length);
    offset += START_DATA.length;
    toBytes(dlength,data, START_DATA.length);
    offset += 4;
    cdata.getDataPackage(data,offset);
    offset += dlength;
    System.arraycopy(END_DATA, 0, data, offset, END_DATA.length);
    offset += END_DATA.length;
    return data;
  }

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

/**
   * Creates a complete data package
   * @param indata - the message data to be contained within the package
   * @param compressed - compression flag for the indata buffer
   * @return - a full package (header,size,data,footer)
   * 
   */
  public static byte[] createDataPackage(ChannelData cdata) {
//        return createDataPackage(cdata.getDataPackage());
    //avoid one extra byte array creation
    int dlength = cdata.getDataPackageLength();
    int length = getDataPackageLength(dlength);
    byte[] data = new byte[length];
    int offset = 0;
    System.arraycopy(START_DATA, 0, data, offset, START_DATA.length);
    offset += START_DATA.length;
    toBytes(dlength,data, START_DATA.length);
    offset += 4;
    cdata.getDataPackage(data,offset);
    offset += dlength;
    System.arraycopy(END_DATA, 0, data, offset, END_DATA.length);
    offset += END_DATA.length;
    return data;
  }

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