本文整理汇总了Java中com.ociweb.pronghorn.pipe.PipeWriter类的典型用法代码示例。如果您正苦于以下问题:Java PipeWriter类的具体用法?Java PipeWriter怎么用?Java PipeWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PipeWriter类属于com.ociweb.pronghorn.pipe包,在下文中一共展示了PipeWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: publishOnPrivateTopic
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
private boolean publishOnPrivateTopic(int token, Writable writable) {
//this is a private topic
Pipe<MessagePrivate> output = publishPrivateTopics.getPipe(token);
if (PipeWriter.tryWriteFragment(output, MessagePrivate.MSG_PUBLISH_1)) {
DataOutputBlobWriter<MessagePrivate> writer = PipeWriter.outputStream(output);
DataOutputBlobWriter.openField(writer);
writable.write(writer);
DataOutputBlobWriter.closeHighLevelField(writer, MessagePrivate.MSG_PUBLISH_1_FIELD_PAYLOAD_3);
PipeWriter.publishWrites(output);
return true;
} else {
return false;
}
}
示例2: publishConnect
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
private void publishConnect(Pipe<MQTTClientRequestSchema> output) {
PipeWriter.presumeWriteFragment(output, MQTTClientRequestSchema.MSG_CONNECT_1);
PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_KEEPALIVESEC_28, keepAliveSeconds);
PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_FLAGS_29, flags);
PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_CLIENTID_30, (CharSequence) clientId);
PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLTOPIC_31, (CharSequence) lastWillTopic);
DataOutputBlobWriter<MQTTClientRequestSchema> writer = PipeWriter.outputStream(output);
DataOutputBlobWriter.openField(writer);
if(null!= lastWillPayload) {
lastWillPayload.write((MQTTWriter)writer);
}
DataOutputBlobWriter.closeHighLevelField(writer, MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLPAYLOAD_32);
PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_USER_33, (CharSequence) user);
PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_PASS_34, (CharSequence) pass);
PipeWriter.publishWrites(output);
}
示例3: copyToSubscriber
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
private void copyToSubscriber(Pipe<?> pipe, int pipeIdx, long[] targetMarks, int topicLOC, int payloadLOC) {
Pipe<MessageSubscription> outPipe = outgoingMessagePipes[pipeIdx];
if (PipeWriter.tryWriteFragment(outPipe, MessageSubscription.MSG_PUBLISH_103)) {
PipeReader.copyBytes(pipe, outPipe, topicLOC, MessageSubscription.MSG_PUBLISH_103_FIELD_TOPIC_1);
PipeReader.copyBytes(pipe, outPipe, payloadLOC, MessageSubscription.MSG_PUBLISH_103_FIELD_PAYLOAD_3);
//due to batching this may not become the head position upon publish but it will do so eventually.
//so to track this position we use workingHeadPosition not headPosition
targetMarks[pipeIdx] = Pipe.workingHeadPosition(outPipe);
PipeWriter.publishWrites(outPipe);
} else {
//add this one back to the list so we can send again later
pendingPublish[pendingPublishCount++] = pipeIdx;
pendingIngress = false;
}
}
示例4: run
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的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;
}
}
}
示例5: writeAndReadImpl
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
private void writeAndReadImpl(boolean encryption, boolean telemetry) {
Pipe<PersistedBlobStoreSchema> perStore = PersistedBlobStoreSchema.instance.newPipe(10, 1000);
perStore.initBuffers();
byte[] fieldByteArrayBacking = "hello".getBytes();
int fieldByteArrayLength = fieldByteArrayBacking.length;
PipeWriter.presumeWriteFragment(perStore, PersistedBlobStoreSchema.MSG_BLOCK_1);
PipeWriter.writeLong(perStore,PersistedBlobStoreSchema.MSG_BLOCK_1_FIELD_BLOCKID_3, (long) 10);
PipeWriter.writeBytes(perStore,PersistedBlobStoreSchema.MSG_BLOCK_1_FIELD_BYTEARRAY_2, fieldByteArrayBacking, 0, fieldByteArrayLength);
PipeWriter.publishWrites(perStore);
PipeWriter.presumeWriteFragment(perStore, PersistedBlobStoreSchema.MSG_REQUESTREPLAY_6);
PipeWriter.publishWrites(perStore);
PipeWriter.publishEOF(perStore); //ensure that the parts do not shut down before we are done
String result = runGraph(perStore, encryption, telemetry);
assertTrue(result, result.indexOf("AckWrite")>0);
assertTrue(result, result.indexOf("{\"BlockId\":10}")>0);
assertTrue(result, result.indexOf("0x68,0x65,0x6c,0x6c,0x6f")>0);
assertTrue(result, result.indexOf("FinishReplay")>0);
}
示例6: run
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
@Override
public void run() {
if (moveInProgress) {
if (!PipeReader.tryMoveSingleMessage(input, output)) {
return;
} else {
moveInProgress = false;
PipeReader.releaseReadLock(input);
}
}
while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) {
count++;
int value = PipeReader.readInt(input, varFieldLoc);
if (0 != (mask&value)) {
if (!PipeReader.tryMoveSingleMessage(input, output)) {
moveInProgress = true;
return;
}
}
PipeReader.releaseReadLock(input);
}
}
示例7: publishUser
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publishUser(Pipe<TwitterEventSchema> output, int fieldFlags, long fieldUserId, CharSequence fieldName, CharSequence fieldScreenName, int fieldFavouritesCount, int fieldFollowersCount, int fieldFriendsCount, CharSequence fieldCreatedAt, CharSequence fieldDescription, int fieldListedCount, CharSequence fieldLanguage, CharSequence fieldTimeZone, CharSequence fieldLocation) {
PipeWriter.presumeWriteFragment(output, MSG_USER_100);
PipeWriter.writeInt(output,MSG_USER_100_FIELD_FLAGS_31, fieldFlags);
PipeWriter.writeLong(output,MSG_USER_100_FIELD_USERID_51, fieldUserId);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_NAME_52, fieldName);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_SCREENNAME_53, fieldScreenName);
PipeWriter.writeInt(output,MSG_USER_100_FIELD_FAVOURITESCOUNT_54, fieldFavouritesCount);
PipeWriter.writeInt(output,MSG_USER_100_FIELD_FOLLOWERSCOUNT_55, fieldFollowersCount);
PipeWriter.writeInt(output,MSG_USER_100_FIELD_FRIENDSCOUNT_56, fieldFriendsCount);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_CREATEDAT_57, fieldCreatedAt);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_DESCRIPTION_58, fieldDescription);
PipeWriter.writeInt(output,MSG_USER_100_FIELD_LISTEDCOUNT_59, fieldListedCount);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_LANGUAGE_60, fieldLanguage);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_TIMEZONE_61, fieldTimeZone);
PipeWriter.writeUTF8(output,MSG_USER_100_FIELD_LOCATION_62, fieldLocation);
PipeWriter.publishWrites(output);
}
示例8: publish015
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publish015(Pipe<PhastCodecSchema> output, long fieldvalue001, long fieldvalue002, long fieldvalue003, long fieldvalue004, long fieldvalue005, long fieldvalue006, long fieldvalue007, long fieldvalue008, long fieldvalue009, long fieldvalue010, long fieldvalue011, long fieldvalue012, long fieldvalue013, long fieldvalue014, long fieldvalue015) {
PipeWriter.presumeWriteFragment(output, MSG_015_10015);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE001_1, fieldvalue001);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE002_2, fieldvalue002);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE003_3, fieldvalue003);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE004_4, fieldvalue004);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE005_5, fieldvalue005);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE006_6, fieldvalue006);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE007_7, fieldvalue007);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE008_8, fieldvalue008);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE009_9, fieldvalue009);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE010_10, fieldvalue010);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE011_11, fieldvalue011);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE012_12, fieldvalue012);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE013_13, fieldvalue013);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE014_14, fieldvalue014);
PipeWriter.writeLong(output,MSG_015_10015_FIELD_VALUE015_15, fieldvalue015);
PipeWriter.publishWrites(output);
}
示例9: publish014
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publish014(Pipe<PhastCodecSchema> output, long fieldvalue001, long fieldvalue002, long fieldvalue003, long fieldvalue004, long fieldvalue005, long fieldvalue006, long fieldvalue007, long fieldvalue008, long fieldvalue009, long fieldvalue010, long fieldvalue011, long fieldvalue012, long fieldvalue013, long fieldvalue014) {
PipeWriter.presumeWriteFragment(output, MSG_014_10014);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE001_1, fieldvalue001);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE002_2, fieldvalue002);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE003_3, fieldvalue003);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE004_4, fieldvalue004);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE005_5, fieldvalue005);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE006_6, fieldvalue006);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE007_7, fieldvalue007);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE008_8, fieldvalue008);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE009_9, fieldvalue009);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE010_10, fieldvalue010);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE011_11, fieldvalue011);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE012_12, fieldvalue012);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE013_13, fieldvalue013);
PipeWriter.writeLong(output,MSG_014_10014_FIELD_VALUE014_14, fieldvalue014);
PipeWriter.publishWrites(output);
}
示例10: populateRingBufferWithBytes
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
private void populateRingBufferWithBytes(Pipe pipe, int blockSize, int testSize) {
int j = testSize;
while (true) {
if (j == 0) {
return;//done
}
if (PipeWriter.tryWriteFragment(pipe,FRAG_LOC)) { //returns true if there is room to write this fragment
Pipe.writeTrailingCountOfBytesConsumed(pipe, FRAG_LOC);
int arraySize = (--j*blockSize)/testSize;
byte[] arrayData = buildTestData(arraySize);
PipeWriter.writeBytes(pipe, FRAG_FIELD, arrayData);
//because there is only 1 template we do not write the template id it is assumed to be zero.
//now we write the data for the message
Pipe.publishWritesBatched(pipe); //must always publish the writes if message or fragment
} else {
//Unable to write because there is no room so do something else while we are waiting.
Thread.yield();
}
}
}
示例11: publish013
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publish013(Pipe<PhastCodecSchema> output, long fieldvalue001, long fieldvalue002, long fieldvalue003, long fieldvalue004, long fieldvalue005, long fieldvalue006, long fieldvalue007, long fieldvalue008, long fieldvalue009, long fieldvalue010, long fieldvalue011, long fieldvalue012, long fieldvalue013) {
PipeWriter.presumeWriteFragment(output, MSG_013_10013);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE001_1, fieldvalue001);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE002_2, fieldvalue002);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE003_3, fieldvalue003);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE004_4, fieldvalue004);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE005_5, fieldvalue005);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE006_6, fieldvalue006);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE007_7, fieldvalue007);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE008_8, fieldvalue008);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE009_9, fieldvalue009);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE010_10, fieldvalue010);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE011_11, fieldvalue011);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE012_12, fieldvalue012);
PipeWriter.writeLong(output,MSG_013_10013_FIELD_VALUE013_13, fieldvalue013);
PipeWriter.publishWrites(output);
}
示例12: publish020
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publish020(Pipe<PhastCodecSchema> output, long fieldvalue001, long fieldvalue002, long fieldvalue003, long fieldvalue004, long fieldvalue005, long fieldvalue006, long fieldvalue007, long fieldvalue008, long fieldvalue009, long fieldvalue010, long fieldvalue011, long fieldvalue012, long fieldvalue013, long fieldvalue014, long fieldvalue015, long fieldvalue016, long fieldvalue017, long fieldvalue018, long fieldvalue019, long fieldvalue020) {
PipeWriter.presumeWriteFragment(output, MSG_020_10020);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE001_1, fieldvalue001);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE002_2, fieldvalue002);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE003_3, fieldvalue003);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE004_4, fieldvalue004);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE005_5, fieldvalue005);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE006_6, fieldvalue006);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE007_7, fieldvalue007);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE008_8, fieldvalue008);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE009_9, fieldvalue009);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE010_10, fieldvalue010);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE011_11, fieldvalue011);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE012_12, fieldvalue012);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE013_13, fieldvalue013);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE014_14, fieldvalue014);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE015_15, fieldvalue015);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE016_16, fieldvalue016);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE017_17, fieldvalue017);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE018_18, fieldvalue018);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE019_19, fieldvalue019);
PipeWriter.writeLong(output,MSG_020_10020_FIELD_VALUE020_20, fieldvalue020);
PipeWriter.publishWrites(output);
}
示例13: publish012
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publish012(Pipe<PhastCodecSchema> output, long fieldvalue001, long fieldvalue002, long fieldvalue003, long fieldvalue004, long fieldvalue005, long fieldvalue006, long fieldvalue007, long fieldvalue008, long fieldvalue009, long fieldvalue010, long fieldvalue011, long fieldvalue012) {
PipeWriter.presumeWriteFragment(output, MSG_012_10012);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE001_1, fieldvalue001);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE002_2, fieldvalue002);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE003_3, fieldvalue003);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE004_4, fieldvalue004);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE005_5, fieldvalue005);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE006_6, fieldvalue006);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE007_7, fieldvalue007);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE008_8, fieldvalue008);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE009_9, fieldvalue009);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE010_10, fieldvalue010);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE011_11, fieldvalue011);
PipeWriter.writeLong(output,MSG_012_10012_FIELD_VALUE012_12, fieldvalue012);
PipeWriter.publishWrites(output);
}
示例14: sentEOF
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
protected boolean sentEOF(Pipe<?> pipe) {
if (null!=pipe) {
PipeWriter.publishEOF(pipe);
return true;
} else {
return false;
}
}
示例15: publishBlockChannel
import com.ociweb.pronghorn.pipe.PipeWriter; //导入依赖的package包/类
public static void publishBlockChannel(long durationNanos, MsgCommandChannel<?> gcc) {
if (null != gcc.goPipe) {
PipeWriter.presumeWriteFragment(gcc.goPipe, TrafficOrderSchema.MSG_BLOCKCHANNEL_22);
PipeWriter.writeLong(gcc.goPipe,TrafficOrderSchema.MSG_BLOCKCHANNEL_22_FIELD_DURATIONNANOS_13, durationNanos);
PipeWriter.publishWrites(gcc.goPipe);
} else {
logger.info("Unable to use block channel for ns without an additonal feature use or USE_DELAY can be added.");
}
}