本文整理汇总了Java中org.apache.cassandra.streaming.StreamSession类的典型用法代码示例。如果您正苦于以下问题:Java StreamSession类的具体用法?Java StreamSession怎么用?Java StreamSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamSession类属于org.apache.cassandra.streaming包,在下文中一共展示了StreamSession类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public IncomingFileMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInputStream input = new DataInputStream(Channels.newInputStream(in));
FileMessageHeader header = FileMessageHeader.serializer.deserialize(input, version);
StreamReader reader = header.compressionInfo == null ? new StreamReader(header, session)
: new CompressedStreamReader(header, session);
try
{
return new IncomingFileMessage(reader.read(in), header);
}
catch (Throwable t)
{
JVMStabilityInspector.inspectThrowable(t);
session.doRetry(header, t);
return null;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:IncomingFileMessage.java
示例2: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
if (in.read(buff) > 0)
{
buff.flip();
Type type = Type.get(buff.get());
return type.inSerializer.deserialize(in, version, session);
}
else
{
// when socket gets closed, there is a chance that buff is empty
// in that case, just return null
return null;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:StreamMessage.java
示例3: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
if (in.read(buff) > 0)
{
buff.flip();
Type type = Type.get(buff.get());
return type.serializer.deserialize(in, version, session);
}
else
{
// when socket gets closed, there is a chance that buff is empty
// in that case, just return null
return null;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:StreamMessage.java
示例4: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public FileMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInputStream input = new DataInputStream(Channels.newInputStream(in));
FileMessageHeader header = FileMessageHeader.serializer.deserialize(input, version);
StreamReader reader = header.compressionInfo == null ? new StreamReader(header, session)
: new CompressedStreamReader(header, session);
try
{
return new FileMessage(reader.read(in), header);
}
catch (Throwable e)
{
session.doRetry(header, e);
return null;
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:FileMessage.java
示例5: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
@SuppressWarnings("resource")
public IncomingFileMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInputPlus input = new DataInputStreamPlus(Channels.newInputStream(in));
FileMessageHeader header = FileMessageHeader.serializer.deserialize(input, version);
StreamReader reader = !header.isCompressed() ? new StreamReader(header, session)
: new CompressedStreamReader(header, session);
try
{
return new IncomingFileMessage(reader.read(in), header);
}
catch (Throwable t)
{
JVMStabilityInspector.inspectThrowable(t);
throw t;
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:19,代码来源:IncomingFileMessage.java
示例6: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public synchronized void serialize(DataOutputStreamPlus out, int version, StreamSession session) throws IOException
{
if (completed)
{
return;
}
CompressionInfo compressionInfo = FileMessageHeader.serializer.serialize(header, out, version);
final SSTableReader reader = ref.get();
StreamWriter writer = compressionInfo == null ?
new StreamWriter(reader, header.sections, session) :
new CompressedStreamWriter(reader, header.sections,
compressionInfo, session);
writer.write(out);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:OutgoingFileMessage.java
示例7: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
int readBytes = in.read(buff);
if (readBytes > 0)
{
buff.flip();
Type type = Type.get(buff.get());
return type.inSerializer.deserialize(in, version, session);
}
else if (readBytes == 0)
{
// input socket buffer was not filled yet
return null;
}
else
{
// possibly socket gets closed
throw new SocketException("End-of-stream reached");
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:StreamMessage.java
示例8: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public IncomingFileMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInputStream input = new DataInputStream(Channels.newInputStream(in));
FileMessageHeader header = FileMessageHeader.serializer.deserialize(input, version);
StreamReader reader = header.compressionInfo == null ? new StreamReader(header, session)
: new CompressedStreamReader(header, session);
try
{
return new IncomingFileMessage(reader.read(in), header);
}
catch (Throwable e)
{
session.doRetry(header, e);
return null;
}
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:18,代码来源:IncomingFileMessage.java
示例9: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public void serialize(OutgoingFileMessage message, DataOutputStreamAndChannel out, int version, StreamSession session) throws IOException
{
FileMessageHeader.serializer.serialize(message.header, out, version);
final SSTableReader reader = message.sstable;
StreamWriter writer = message.header.compressionInfo == null ?
new StreamWriter(reader, message.header.sections, session) :
new CompressedStreamWriter(reader,
message.header.sections,
message.header.compressionInfo, session);
writer.write(out.getChannel());
session.fileSent(message.header);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:OutgoingFileMessage.java
示例10: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public PrepareMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInput input = new DataInputStream(Channels.newInputStream(in));
PrepareMessage message = new PrepareMessage();
// requests
int numRequests = input.readInt();
for (int i = 0; i < numRequests; i++)
message.requests.add(StreamRequest.serializer.deserialize(input, version));
// summaries
int numSummaries = input.readInt();
for (int i = 0; i < numSummaries; i++)
message.summaries.add(StreamSummary.serializer.deserialize(input, version));
return message;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:PrepareMessage.java
示例11: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public void serialize(PrepareMessage message, DataOutputStreamAndChannel out, int version, StreamSession session) throws IOException
{
// requests
out.writeInt(message.requests.size());
for (StreamRequest request : message.requests)
StreamRequest.serializer.serialize(request, out, version);
// summaries
out.writeInt(message.summaries.size());
for (StreamSummary summary : message.summaries)
StreamSummary.serializer.serialize(summary, out, version);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:PrepareMessage.java
示例12: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static void serialize(StreamMessage message, DataOutputStreamAndChannel out, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
// message type
buff.put(message.type.type);
buff.flip();
out.write(buff);
message.type.outSerializer.serialize(message, out, version, session);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:StreamMessage.java
示例13: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public void serialize(PrepareMessage message, WritableByteChannel out, int version, StreamSession session) throws IOException
{
DataOutput output = new DataOutputStream(Channels.newOutputStream(out));
// requests
output.writeInt(message.requests.size());
for (StreamRequest request : message.requests)
StreamRequest.serializer.serialize(request, output, version);
// summaries
output.writeInt(message.summaries.size());
for (StreamSummary summary : message.summaries)
StreamSummary.serializer.serialize(summary, output, version);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:PrepareMessage.java
示例14: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static void serialize(StreamMessage message, WritableByteChannel out, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
// message type
buff.put(message.type.type);
buff.flip();
out.write(buff);
message.type.serializer.serialize(message, out, version, session);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:10,代码来源:StreamMessage.java
示例15: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public void serialize(FileMessage message, WritableByteChannel out, int version, StreamSession session) throws IOException
{
DataOutput output = new DataOutputStream(Channels.newOutputStream(out));
FileMessageHeader.serializer.serialize(message.header, output, version);
StreamWriter writer = message.header.compressionInfo == null ?
new StreamWriter(message.sstable, message.header.sections, session) :
new CompressedStreamWriter(message.sstable,
message.header.sections,
message.header.compressionInfo, session);
writer.write(out);
session.fileSent(message.header);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:13,代码来源:FileMessage.java
示例16: deserialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
@SuppressWarnings("resource") // Not closing constructed DataInputPlus's as the channel needs to remain open.
public PrepareMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException
{
DataInputPlus input = new DataInputStreamPlus(Channels.newInputStream(in));
PrepareMessage message = new PrepareMessage();
// requests
int numRequests = input.readInt();
for (int i = 0; i < numRequests; i++)
message.requests.add(StreamRequest.serializer.deserialize(input, version));
// summaries
int numSummaries = input.readInt();
for (int i = 0; i < numSummaries; i++)
message.summaries.add(StreamSummary.serializer.deserialize(input, version));
return message;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:16,代码来源:PrepareMessage.java
示例17: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public void serialize(PrepareMessage message, DataOutputStreamPlus out, int version, StreamSession session) throws IOException
{
// requests
out.writeInt(message.requests.size());
for (StreamRequest request : message.requests)
StreamRequest.serializer.serialize(request, out, version);
// summaries
out.writeInt(message.summaries.size());
for (StreamSummary summary : message.summaries)
StreamSummary.serializer.serialize(summary, out, version);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:12,代码来源:PrepareMessage.java
示例18: serialize
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
public static void serialize(StreamMessage message, DataOutputStreamPlus out, int version, StreamSession session) throws IOException
{
ByteBuffer buff = ByteBuffer.allocate(1);
// message type
buff.put(message.type.type);
buff.flip();
out.write(buff);
message.type.outSerializer.serialize(message, out, version, session);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:StreamMessage.java
示例19: streamLegacyTable
import org.apache.cassandra.streaming.StreamSession; //导入依赖的package包/类
private void streamLegacyTable(String tablePattern, String legacyVersion, String compactNameSuffix) throws Exception
{
String table = String.format(tablePattern, legacyVersion, compactNameSuffix);
SSTableReader sstable = SSTableReader.open(getDescriptor(legacyVersion, table));
IPartitioner p = sstable.getPartitioner();
List<Range<Token>> ranges = new ArrayList<>();
ranges.add(new Range<>(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("100"))));
ranges.add(new Range<>(p.getToken(ByteBufferUtil.bytes("100")), p.getMinimumToken()));
ArrayList<StreamSession.SSTableStreamingSections> details = new ArrayList<>();
details.add(new StreamSession.SSTableStreamingSections(sstable.ref(),
sstable.getPositionsForRanges(ranges),
sstable.estimatedKeysForRanges(ranges), sstable.getSSTableMetadata().repairedAt));
new StreamPlan("LegacyStreamingTest").transferFiles(FBUtilities.getBroadcastAddress(), details)
.execute().get();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:16,代码来源:LegacySSTableTest.java
注:本文中的org.apache.cassandra.streaming.StreamSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论