gpt4 book ai didi

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

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

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

XByteBuffer.reset介绍

暂无

代码示例

代码示例来源: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: 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.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: codefollower/Tomcat-Research

public void write() {
    buf.reset();
    //header
    buf.append(COORD_HEADER,0,COORD_HEADER.length);
    //leader
    byte[] ldr = leader.getData(false,false);
    buf.append(ldr.length);
    buf.append(ldr,0,ldr.length);
    ldr = null;
    //source
    byte[] src = source.getData(false,false);
    buf.append(src.length);
    buf.append(src,0,src.length);
    src = null;
    //view
    buf.append(view.length);
    for (int i=0; i<view.length; i++ ) {
      byte[] mbr = view[i].getData(false,false);
      buf.append(mbr.length);
      buf.append(mbr,0,mbr.length);
    }
    //id
    buf.append(id.getBytes(),0,id.getBytes().length);
    buf.append(type,0,type.length);
  }
}

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

public void write() {
    buf.reset();
    //header
    buf.append(COORD_HEADER,0,COORD_HEADER.length);
    //leader
    byte[] ldr = leader.getData(false,false);
    buf.append(ldr.length);
    buf.append(ldr,0,ldr.length);
    ldr = null;
    //source
    byte[] src = source.getData(false,false);
    buf.append(src.length);
    buf.append(src,0,src.length);
    src = null;
    //view
    buf.append(view.length);
    for (int i=0; i<view.length; i++ ) {
      byte[] mbr = view[i].getData(false,false);
      buf.append(mbr.length);
      buf.append(mbr,0,mbr.length);
    }
    //id
    buf.append(id.getBytes(),0,id.getBytes().length);
    buf.append(type,0,type.length);
  }
}

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

public void write() {
    buf.reset();
    //header
    buf.append(COORD_HEADER,0,COORD_HEADER.length);
    //leader
    byte[] ldr = leader.getData(false,false);
    buf.append(ldr.length);
    buf.append(ldr,0,ldr.length);
    ldr = null;
    //source
    byte[] src = source.getData(false,false);
    buf.append(src.length);
    buf.append(src,0,src.length);
    src = null;
    //view
    buf.append(view.length);
    for (int i=0; i<view.length; i++ ) {
      byte[] mbr = view[i].getData(false,false);
      buf.append(mbr.length);
      buf.append(mbr,0,mbr.length);
    }
    //id
    buf.append(id.getBytes(),0,id.getBytes().length);
    buf.append(type,0,type.length);
  }
}

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

public void write() {
    buf.reset();
    //header
    buf.append(COORD_HEADER,0,COORD_HEADER.length);
    //leader
    byte[] ldr = leader.getData(false,false);
    buf.append(ldr.length);
    buf.append(ldr,0,ldr.length);
    ldr = null;
    //source
    byte[] src = source.getData(false,false);
    buf.append(src.length);
    buf.append(src,0,src.length);
    src = null;
    //view
    buf.append(view.length);
    for (int i=0; i<view.length; i++ ) {
      byte[] mbr = view[i].getData(false,false);
      buf.append(mbr.length);
      buf.append(mbr,0,mbr.length);
    }
    //id
    buf.append(id.getBytes(),0,id.getBytes().length);
    buf.append(type,0,type.length);
  }
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
  ChannelException {
  //todo, optimize, if destination.length==1, then we can do
  //msg.setOptions(msg.getOptions() & (~getOptionFlag())
  //and just send one message
  if (okToProcess(msg.getOptions()) ) {
    super.sendMessage(destination, msg, null);
    ChannelMessage confirmation = null;
    if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
    else confirmation = (ChannelMessage)msg.clone();
    confirmation.getMessage().reset();
    UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
    confirmation.getMessage().append(START_DATA,0,START_DATA.length);
    confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
    confirmation.getMessage().append(END_DATA,0,END_DATA.length);
    super.sendMessage(destination,confirmation,payload);
  } else {
    //turn off two phase commit
    //this wont work if the interceptor has 0 as a flag
    //since there is no flag to turn off
    //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
    super.sendMessage(destination, msg, payload);
  }
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
  ChannelException {
  //todo, optimize, if destination.length==1, then we can do
  //msg.setOptions(msg.getOptions() & (~getOptionFlag())
  //and just send one message
  if (okToProcess(msg.getOptions()) ) {
    super.sendMessage(destination, msg, null);
    ChannelMessage confirmation = null;
    if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
    else confirmation = (ChannelMessage)msg.clone();
    confirmation.getMessage().reset();
    UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
    confirmation.getMessage().append(START_DATA,0,START_DATA.length);
    confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
    confirmation.getMessage().append(END_DATA,0,END_DATA.length);
    super.sendMessage(destination,confirmation,payload);
  } else {
    //turn off two phase commit
    //this wont work if the interceptor has 0 as a flag
    //since there is no flag to turn off
    //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
    super.sendMessage(destination, msg, payload);
  }
}

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

public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
  ChannelException {
  //todo, optimize, if destination.length==1, then we can do
  //msg.setOptions(msg.getOptions() & (~getOptionFlag())
  //and just send one message
  if (okToProcess(msg.getOptions()) ) {
    super.sendMessage(destination, msg, null);
    ChannelMessage confirmation = null;
    if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
    else confirmation = (ChannelMessage)msg.clone();
    confirmation.getMessage().reset();
    UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
    confirmation.getMessage().append(START_DATA,0,START_DATA.length);
    confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
    confirmation.getMessage().append(END_DATA,0,END_DATA.length);
    super.sendMessage(destination,confirmation,payload);
  } else {
    //turn off two phase commit
    //this wont work if the interceptor has 0 as a flag
    //since there is no flag to turn off
    //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
    super.sendMessage(destination, msg, payload);
  }
}

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

@Override
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws
  ChannelException {
  //todo, optimize, if destination.length==1, then we can do
  //msg.setOptions(msg.getOptions() & (~getOptionFlag())
  //and just send one message
  if (okToProcess(msg.getOptions()) ) {
    super.sendMessage(destination, msg, null);
    ChannelMessage confirmation = null;
    if ( deepclone ) confirmation = (ChannelMessage)msg.deepclone();
    else confirmation = (ChannelMessage)msg.clone();
    confirmation.getMessage().reset();
    UUIDGenerator.randomUUID(false,confirmation.getUniqueId(),0);
    confirmation.getMessage().append(START_DATA,0,START_DATA.length);
    confirmation.getMessage().append(msg.getUniqueId(),0,msg.getUniqueId().length);
    confirmation.getMessage().append(END_DATA,0,END_DATA.length);
    super.sendMessage(destination,confirmation,payload);
  } else {
    //turn off two phase commit
    //this wont work if the interceptor has 0 as a flag
    //since there is no flag to turn off
    //msg.setOptions(msg.getOptions() & (~getOptionFlag()));
    super.sendMessage(destination, msg, payload);
  }
}

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