当前位置: 首页>>代码示例>>Java>>正文


Java XByteBuffer.firstIndexOf方法代码示例

本文整理汇总了Java中org.apache.catalina.tribes.io.XByteBuffer.firstIndexOf方法的典型用法代码示例。如果您正苦于以下问题:Java XByteBuffer.firstIndexOf方法的具体用法?Java XByteBuffer.firstIndexOf怎么用?Java XByteBuffer.firstIndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.tribes.io.XByteBuffer的用法示例。


在下文中一共展示了XByteBuffer.firstIndexOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: receive

import org.apache.catalina.tribes.io.XByteBuffer; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:29,代码来源:McastServiceImpl.java

示例2: receive

import org.apache.catalina.tribes.io.XByteBuffer; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:31,代码来源:McastServiceImpl.java


注:本文中的org.apache.catalina.tribes.io.XByteBuffer.firstIndexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。