private static void writeOtherAddress(Address addr,DataOutput out) throws Exception { short magic_number=ClassConfigurator.getMagicNumber(addr.getClass()); // write the class info if(magic_number == -1) throw new RuntimeException("magic number " + magic_number + " not found"); out.writeShort(magic_number); addr.writeTo(out); }
/** * Send the cookie first, then the our port number. If the cookie * doesn't match the receiver's cookie, the receiver will reject the * connection and close it. */ protected void sendLocalAddress(Address local_addr) throws Exception { try { // write the cookie out.write(cookie, 0, cookie.length); // write the version out.writeShort(Version.version); out.writeShort(local_addr.serializedSize()); // address size local_addr.writeTo(out); out.flush(); // needed ? updateLastAccessed(); } catch(Exception ex) { server.socket_factory.close(this.sock); connected=false; throw ex; } }
out.writeByte(flags); if(streamable_addr) addr.writeTo(out); else writeOtherAddress(addr,out);
protected void sendLocalAddress(Address local_addr) throws Exception { try { int addr_size=local_addr.serializedSize(); int expected_size=cookie.length + Global.SHORT_SIZE*2 + addr_size; ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(expected_size +2); out.write(cookie, 0, cookie.length); out.writeShort(Version.version); out.writeShort(addr_size); // address size local_addr.writeTo(out); ByteBuffer buf=out.getByteBuffer(); send(buf, false); updateLastAccessed(); } catch(Exception ex) { close(); throw ex; } }
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeUTF(this.jgAddress.getClass().getName()); try { this.jgAddress.writeTo(out); } catch (Exception e) { throw new IOException(e); } }
private static void writeOtherAddress(Address addr,DataOutput out) throws Exception { short magic_number=ClassConfigurator.getMagicNumber(addr.getClass()); // write the class info if(magic_number == -1) throw new RuntimeException("magic number " + magic_number + " not found"); out.writeShort(magic_number); addr.writeTo(out); }
public static void writeAddress(Address addr, DataOutputStream out) throws IOException { if(addr == null) { out.writeBoolean(false); return; } out.writeBoolean(true); if(addr instanceof IpAddress) { // regular case, we don't need to include class information about the type of Address, e.g. JmsAddress out.writeBoolean(true); addr.writeTo(out); } else { out.writeBoolean(false); writeOtherAddress(addr, out); } }
/** * Send the cookie first, then the our port number. If the cookie doesn't match the receiver's cookie, * the receiver will reject the connection and close it. */ void sendLocalAddress(Address local_addr) { if(local_addr == null) { if(log.isWarnEnabled()) log.warn("local_addr is null"); return; } if(out != null) { try { // write the cookie out.write(cookie, 0, cookie.length); // write the version out.writeShort(Version.version); local_addr.writeTo(out); out.flush(); // needed ? updateLastAccessed(); } catch(Throwable t) { if(log.isErrorEnabled()) log.error("exception is " + t); } } }
private static void writeOtherAddress(Address addr, DataOutputStream out) throws IOException { ClassConfigurator conf=null; try { conf=ClassConfigurator.getInstance(false); } catch(ChannelException e) { IOException new_ex=new IOException(); new_ex.initCause(e); throw new_ex; } short magic_number=conf != null? conf.getMagicNumber(addr.getClass()) : -1; // write the class info if(magic_number == -1) { out.write(0); out.writeUTF(addr.getClass().getName()); } else { out.write(1); out.writeShort(magic_number); } // write the data itself addr.writeTo(out); }
/** * Send the cookie first, then the our port number. If the cookie * doesn't match the receiver's cookie, the receiver will reject the * connection and close it. */ protected void sendLocalAddress(Address local_addr) throws Exception { try { // write the cookie out.write(cookie, 0, cookie.length); // write the version out.writeShort(Version.version); out.writeShort(local_addr.serializedSize()); // address size local_addr.writeTo(out); out.flush(); // needed ? updateLastAccessed(); } catch(Exception ex) { server.socket_factory.close(this.sock); connected=false; throw ex; } }
src_addr.writeTo(out);
out.writeByte(flags); if(streamable_addr) addr.writeTo(out); else writeOtherAddress(addr,out);
protected void sendLocalAddress(Address local_addr) throws Exception { try { int addr_size=local_addr.serializedSize(); int expected_size=cookie.length + Global.SHORT_SIZE*2 + addr_size; ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(expected_size +2); out.write(cookie, 0, cookie.length); out.writeShort(Version.version); out.writeShort(addr_size); // address size local_addr.writeTo(out); ByteBuffer buf=out.getByteBuffer(); send(buf, false); updateLastAccessed(); } catch(Exception ex) { close(); throw ex; } }