Java Code Examples for org.apache.catalina.tribes.io.XByteBuffer#firstIndexOf()
The following examples show how to use
org.apache.catalina.tribes.io.XByteBuffer#firstIndexOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: McastServiceImpl.java From Tomcat8-Source-Read with MIT License | 6 votes |
/** * Receive a datagram packet, locking wait * @throws IOException Received failed */ public void receive() throws IOException { boolean checkexpired = true; try { socket.receive(receivePacket); if(receivePacket.getLength() > MAX_PACKET_SIZE) { log.error(sm.getString("mcastServiceImpl.packet.tooLong", Integer.toString(receivePacket.getLength()))); } else { byte[] data = new byte[receivePacket.getLength()]; System.arraycopy(receivePacket.getData(), receivePacket.getOffset(), data, 0, data.length); if (XByteBuffer.firstIndexOf(data,0,MemberImpl.TRIBES_MBR_BEGIN)==0) { memberDataReceived(data); } else { memberBroadcastsReceived(data); } } } catch (SocketTimeoutException x ) { //do nothing, this is normal, we don't want to block forever //since the receive thread is the same thread //that does membership expiration } if (checkexpired) checkExpired(); }
Example 2
Source File: McastServiceImpl.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
/** * Receive a datagram packet, locking wait * @throws IOException */ public void receive() throws IOException { boolean checkexpired = true; try { socket.receive(receivePacket); if(receivePacket.getLength() > MAX_PACKET_SIZE) { log.error("Multicast packet received was too long, dropping package:"+receivePacket.getLength()); } else { byte[] data = new byte[receivePacket.getLength()]; System.arraycopy(receivePacket.getData(), receivePacket.getOffset(), data, 0, data.length); if (XByteBuffer.firstIndexOf(data,0,MemberImpl.TRIBES_MBR_BEGIN)==0) { memberDataReceived(data); } else { memberBroadcastsReceived(data); } } } catch (SocketTimeoutException x ) { //do nothing, this is normal, we don't want to block forever //since the receive thread is the same thread //that does membership expiration } if (checkexpired) checkExpired(); }
Example 3
Source File: McastServiceImpl.java From tomcatsrc with Apache License 2.0 | 6 votes |
/** * Receive a datagram packet, locking wait * @throws IOException */ public void receive() throws IOException { boolean checkexpired = true; try { socket.receive(receivePacket); if(receivePacket.getLength() > MAX_PACKET_SIZE) { log.error("Multicast packet received was too long, dropping package:"+receivePacket.getLength()); } else { byte[] data = new byte[receivePacket.getLength()]; System.arraycopy(receivePacket.getData(), receivePacket.getOffset(), data, 0, data.length); if (XByteBuffer.firstIndexOf(data,0,MemberImpl.TRIBES_MBR_BEGIN)==0) { memberDataReceived(data); } else { memberBroadcastsReceived(data); } } } catch (SocketTimeoutException x ) { //do nothing, this is normal, we don't want to block forever //since the receive thread is the same thread //that does membership expiration } if (checkexpired) checkExpired(); }