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


Java PipeReader.tryReadFragment方法代码示例

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


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

示例1: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<MessagePubSub> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_SUBSCRIBE_100:
                consumeSubscribe(input);
            break;
            case MSG_UNSUBSCRIBE_101:
                consumeUnsubscribe(input);
            break;
            case MSG_PUBLISH_103:
                consumePublish(input);
            break;
            case MSG_CHANGESTATE_70:
                consumeChangeState(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:24,代码来源:MessagePubSub.java

示例2: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<TrafficOrderSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_GO_10:
                consumeGo(input);
            break;
            case MSG_BLOCKCHANNEL_22:
                consumeBlockChannel(input);
            break;
            case MSG_BLOCKCHANNELUNTIL_23:
                consumeBlockChannelUntil(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:21,代码来源:TrafficOrderSchema.java

示例3: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<MessageSubscription> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_PUBLISH_103:
                consumePublish(input);
            break;
            case MSG_STATECHANGED_71:
                consumeStateChanged(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:18,代码来源:MessageSubscription.java

示例4: run

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
@Override
public void run() {
	while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) {
		int msgIdx = PipeReader.getMsgIdx(input);
		//System.out.format("\nMessage Idx %d %d %d\n", msgIdx, Pipe.tailPosition(input), input.sizeOfSlabRing);
		if (msgIdx >= 0) {
			MessageProcessor msg = messages[msgIdx];
			if (msg != null) {
				msg.readAndWrite(input, output);
			}
			//else {
				//System.out.format("Not Found %d", msgIdx);
			//}
			PipeReader.releaseReadLock(input);
		}
		else {
			PipeReader.releaseReadLock(input);
			PipeWriter.publishEOF(output);
			requestShutdown();
			//System.out.format("End of the line");
			return;
		}
	}
}
 
开发者ID:oci-pronghorn,项目名称:FogLight-Examples,代码行数:25,代码来源:FilterStage.java

示例5: run

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
@Override
public void run() {
	
	//TODO: (a short easy task) twitter wants a growing back-off here, we must record the last time we connected and DO NOT read until sufficient time has passed.
	
	while (PipeWriter.hasRoomForWrite(output) &&
			PipeReader.tryReadFragment(control)) {			
		int id = PipeReader.getMsgIdx(control);
		switch (id) {
			case -1:
				requestShutdown();
				return;				
			default:
				streamingRequest(output, id);
		}			
		PipeReader.releaseReadLock(control);			
	}
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:19,代码来源:RequestTwitterUserStreamStage.java

示例6: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<NetResponseSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_RESPONSE_101:
                consumeResponse(input);
            break;
            case MSG_CONTINUATION_102:
                consumeContinuation(input);
            break;
            case MSG_CLOSED_10:
                consumeClosed(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:21,代码来源:NetResponseSchema.java

示例7: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<PersistedBlobStoreSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_BLOCK_1:
                consumeBlock(input);
            break;
            case MSG_RELEASE_7:
                consumeRelease(input);
            break;
            case MSG_REQUESTREPLAY_6:
                consumeRequestReplay(input);
            break;
            case MSG_CLEAR_12:
                consumeClear(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:24,代码来源:PersistedBlobStoreSchema.java

示例8: slowCreate

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
private static <T> T slowCreate(final EventProducer consumer, Class<T> clazz) {
	int msgIdx = FieldReferenceOffsetManager.lookupTemplateLocator(clazz.getAnnotation(ProngTemplateMessage.class).templateId(), Pipe.from(consumer.input));

	if (PipeReader.tryReadFragment(consumer.input)) {
		
		T result = (T) Proxy.newProxyInstance(
							clazz.getClassLoader(),
							new Class[] { clazz },
							new InputPipeInvocationHandler(consumer.input, PipeReader.getMsgIdx(consumer.input), clazz));	
		
		consumer.cached = result; //TODO: needs smarter pool but this is fine for now.
		consumer.cachedMsgId = PipeReader.getMsgIdx(consumer.input);
		
		return result;
		
	} else {
		return null;
	}
}
 
开发者ID:oci-pronghorn,项目名称:PronghornPipes,代码行数:20,代码来源:EventProducer.java

示例9: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<NetPayloadSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_ENCRYPTED_200:
                consumeEncrypted(input);
            break;
            case MSG_PLAIN_210:
                consumePlain(input);
            break;
            case MSG_DISCONNECT_203:
                consumeDisconnect(input);
            break;
            case MSG_UPGRADE_307:
                consumeUpgrade(input);
            break;
            case MSG_BEGIN_208:
                consumeBegin(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:27,代码来源:NetPayloadSchema.java

示例10: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<TwitterEventSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_USER_100:
                consumeUser(input);
            break;
            case MSG_USERPOST_101:
                consumeUserPost(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:18,代码来源:TwitterEventSchema.java

示例11: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<BlockStorageXmitSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_WRITE_1:
                consumeWrite(input);
            break;
            case MSG_READ_2:
                consumeRead(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:18,代码来源:BlockStorageXmitSchema.java

示例12: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<GroveResponseSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_DIGITALSAMPLE_20:
                consumeDigitalSample(input);
            break;
            case MSG_ANALOGSAMPLE_30:
                consumeAnalogSample(input);
            break;
            case MSG_ENCODER_70:
                consumeEncoder(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:FogLight,代码行数:21,代码来源:GroveResponseSchema.java

示例13: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<IngressMessages> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_PUBLISH_103:
                consumePublish(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:15,代码来源:IngressMessages.java

示例14: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<TrafficAckSchema> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_DONE_10:
                consumeDone(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:15,代码来源:TrafficAckSchema.java

示例15: consume

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consume(Pipe<MessagePrivate> input) {
    while (PipeReader.tryReadFragment(input)) {
        int msgIdx = PipeReader.getMsgIdx(input);
        switch(msgIdx) {
            case MSG_PUBLISH_1:
                consumePublish(input);
            break;
            case -1:
               //requestShutdown();
            break;
        }
        PipeReader.releaseReadLock(input);
    }
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:15,代码来源:MessagePrivate.java


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