本文整理了Java中org.jgroups.Message.createHeaders()
方法的一些代码示例,展示了Message.createHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.createHeaders()
方法的具体详情如下:
包路径:org.jgroups.Message
类名称:Message
方法名:createHeaders
暂无
代码示例来源:origin: wildfly/wildfly
public Message(boolean create_headers) {
if(create_headers)
headers=createHeaders(Util.DEFAULT_HEADERS);
}
代码示例来源:origin: wildfly/wildfly
/**
* Constructs a message given a destination address
* @param dest The Address of the receiver. If it is null, then the message is sent to the group. Otherwise, it is
* sent to a single member.
*/
public Message(Address dest) {
setDest(dest);
headers=createHeaders(Util.DEFAULT_HEADERS);
}
代码示例来源:origin: wildfly/wildfly
public void readFrom(DataInput in) throws Exception {
// 1. read the leading byte first
byte leading=in.readByte();
// 2. the flags
flags=in.readShort();
// 3. dest_addr
if(Util.isFlagSet(leading, DEST_SET))
dest_addr=Util.readAddress(in);
// 4. src_addr
if(Util.isFlagSet(leading, SRC_SET))
src_addr=Util.readAddress(in);
// 5. headers
int len=in.readShort();
this.headers=createHeaders(len);
for(int i=0; i < len; i++) {
short id=in.readShort();
Header hdr=readHeader(in).setProtId(id);
this.headers[i]=hdr;
}
// 6. buf
if(Util.isFlagSet(leading, BUF_SET)) {
len=in.readInt();
buf=new byte[len];
in.readFully(buf, 0, len);
length=len;
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Create a copy of the message. If offset and length are used (to refer to another buffer), the
* copy will contain only the subset offset and length point to, copying the subset into the new
* copy.<p/>
* Note that for headers, only the arrays holding references to the headers are copied, not the headers themselves !
* The consequence is that the headers array of the copy hold the *same* references as the original, so do *not*
* modify the headers ! If you want to change a header, copy it and call {@link Message#putHeader(short,Header)} again.
*
* @param copy_buffer
* @param copy_headers
* Copy the headers
* @return Message with specified data
*/
public Message copy(boolean copy_buffer, boolean copy_headers) {
Message retval=new Message(false);
retval.dest_addr=dest_addr;
retval.src_addr=src_addr;
short tmp_flags=this.flags;
byte tmp_tflags=this.transient_flags;
retval.flags=tmp_flags;
retval.transient_flags=tmp_tflags;
if(copy_buffer && buf != null)
retval.setBuffer(buf, offset, length);
//noinspection NonAtomicOperationOnVolatileField
retval.headers=copy_headers && headers != null? Headers.copy(this.headers) : createHeaders(Util.DEFAULT_HEADERS);
return retval;
}
代码示例来源:origin: wildfly/wildfly
/** Reads the message's contents from an input stream, but skips the buffer and instead returns the
* position (offset) at which the buffer starts */
public int readFromSkipPayload(ByteArrayDataInputStream in) throws Exception {
// 1. read the leading byte first
byte leading=in.readByte();
// 2. the flags
flags=in.readShort();
// 3. dest_addr
if(Util.isFlagSet(leading, DEST_SET))
dest_addr=Util.readAddress(in);
// 4. src_addr
if(Util.isFlagSet(leading, SRC_SET))
src_addr=Util.readAddress(in);
// 5. headers
int len=in.readShort();
headers=createHeaders(len);
for(int i=0; i < len; i++) {
short id=in.readShort();
Header hdr=readHeader(in).setProtId(id);
this.headers[i]=hdr;
}
// 6. buf
if(!Util.isFlagSet(leading, BUF_SET))
return -1;
length=in.readInt();
return in.position();
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public Message(boolean create_headers) {
if(create_headers)
headers=createHeaders(7);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public Message(boolean create_headers) {
if(create_headers)
headers=createHeaders(Util.DEFAULT_HEADERS);
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public Message() {
headers=createHeaders(7);
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
/** Public constructor
* @param dest Address of receiver. If it is <em>null</em> then the message sent to the group.
* Otherwise, it contains a single destination and is sent to that member.<p>
*/
public Message(Address dest) {
setDest(dest);
headers=createHeaders(7);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Constructs a message given a destination address
* @param dest The Address of the receiver. If it is null, then the message is sent to the group. Otherwise, it is
* sent to a single member.
*/
public Message(Address dest) {
setDest(dest);
headers=createHeaders(Util.DEFAULT_HEADERS);
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
/**
* Create a copy of the message. If offset and length are used (to refer to another buffer), the copy will
* contain only the subset offset and length point to, copying the subset into the new copy.
* @param copy_buffer
* @return Message with specified data
*/
public Message copy(boolean copy_buffer) {
Message retval=new Message(false);
retval.dest_addr=dest_addr;
retval.src_addr=src_addr;
retval.flags=flags;
if(copy_buffer && buf != null) {
// change bela Feb 26 2004: we don't resolve the reference
retval.setBuffer(buf, offset, length);
}
header_lock.readLock().lock();
try {
retval.headers=createHeaders(headers);
}
finally {
header_lock.readLock().unlock();
}
return retval;
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
headers=createHeaders(len);
for(int i=0; i < len; i++) {
hdr_name=in.readUTF();
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public void readFrom(DataInput in) throws Exception {
// 1. read the leading byte first
byte leading=in.readByte();
// 2. the flags
flags=in.readShort();
// 3. dest_addr
if(Util.isFlagSet(leading, DEST_SET))
dest_addr=Util.readAddress(in);
// 4. src_addr
if(Util.isFlagSet(leading, SRC_SET))
src_addr=Util.readAddress(in);
// 5. headers
int len=in.readShort();
this.headers=createHeaders(len);
for(int i=0; i < len; i++) {
short id=in.readShort();
Header hdr=readHeader(in).setProtId(id);
this.headers[i]=hdr;
}
// 6. buf
if(Util.isFlagSet(leading, BUF_SET)) {
len=in.readInt();
buf=new byte[len];
in.readFully(buf, 0, len);
length=len;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Create a copy of the message. If offset and length are used (to refer to another buffer), the
* copy will contain only the subset offset and length point to, copying the subset into the new
* copy.<p/>
* Note that for headers, only the arrays holding references to the headers are copied, not the headers themselves !
* The consequence is that the headers array of the copy hold the *same* references as the original, so do *not*
* modify the headers ! If you want to change a header, copy it and call {@link Message#putHeader(short,Header)} again.
*
* @param copy_buffer
* @param copy_headers
* Copy the headers
* @return Message with specified data
*/
public Message copy(boolean copy_buffer, boolean copy_headers) {
Message retval=new Message(false);
retval.dest_addr=dest_addr;
retval.src_addr=src_addr;
short tmp_flags=this.flags;
byte tmp_tflags=this.transient_flags;
retval.flags=tmp_flags;
retval.transient_flags=tmp_tflags;
if(copy_buffer && buf != null)
retval.setBuffer(buf, offset, length);
//noinspection NonAtomicOperationOnVolatileField
retval.headers=copy_headers && headers != null? Headers.copy(this.headers) : createHeaders(Util.DEFAULT_HEADERS);
return retval;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/** Reads the message's contents from an input stream, but skips the buffer and instead returns the
* position (offset) at which the buffer starts */
public int readFromSkipPayload(ByteArrayDataInputStream in) throws Exception {
// 1. read the leading byte first
byte leading=in.readByte();
// 2. the flags
flags=in.readShort();
// 3. dest_addr
if(Util.isFlagSet(leading, DEST_SET))
dest_addr=Util.readAddress(in);
// 4. src_addr
if(Util.isFlagSet(leading, SRC_SET))
src_addr=Util.readAddress(in);
// 5. headers
int len=in.readShort();
headers=createHeaders(len);
for(int i=0; i < len; i++) {
short id=in.readShort();
Header hdr=readHeader(in).setProtId(id);
this.headers[i]=hdr;
}
// 6. buf
if(!Util.isFlagSet(leading, BUF_SET))
return -1;
length=in.readInt();
return in.position();
}
内容来源于网络,如有侵权,请联系作者删除!