本文整理汇总了Java中org.apache.cassandra.transport.Message类的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于org.apache.cassandra.transport包,在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
List<String> cqlVersions = new ArrayList<String>();
cqlVersions.add(QueryProcessor.CQL_VERSION.toString());
List<String> compressions = new ArrayList<String>();
if (FrameCompressor.SnappyCompressor.instance != null)
compressions.add("snappy");
// LZ4 is always available since worst case scenario it default to a pure JAVA implem.
compressions.add("lz4");
Map<String, List<String>> supported = new HashMap<String, List<String>>();
supported.put(StartupMessage.CQL_VERSION, cqlVersions);
supported.put(StartupMessage.COMPRESSION, compressions);
return new SupportedMessage(supported);
}
示例2: execute
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
try
{
AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);
state.getClientState().login(user);
return new ReadyMessage();
}
catch (AuthenticationException e)
{
return ErrorMessage.fromException(e);
}
}
示例3: execute
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
try
{
AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().legacyAuthenticate(credentials);
state.getClientState().login(user);
}
catch (AuthenticationException e)
{
return ErrorMessage.fromException(e);
}
return new ReadyMessage();
}
示例4: testLargeBatchWithProtoV4
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
@Test
public void testLargeBatchWithProtoV4() throws Exception
{
createTable("CREATE TABLE %s (pk int PRIMARY KEY, v text)");
try (SimpleClient client = new SimpleClient(nativeAddr.getHostAddress(), nativePort, Server.VERSION_4))
{
client.connect(false);
QueryMessage query = new QueryMessage(createBatchStatement(DatabaseDescriptor.getBatchSizeWarnThreshold()), QueryOptions.DEFAULT);
Message.Response resp = client.execute(query);
assertEquals(1, resp.getWarnings().size());
}
}
示例5: testLargeBatchWithProtoV2
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
@Test
public void testLargeBatchWithProtoV2() throws Exception
{
createTable("CREATE TABLE %s (pk int PRIMARY KEY, v text)");
try (SimpleClient client = new SimpleClient(nativeAddr.getHostAddress(), nativePort, Server.VERSION_3))
{
client.connect(false);
QueryMessage query = new QueryMessage(createBatchStatement(DatabaseDescriptor.getBatchSizeWarnThreshold()), QueryOptions.DEFAULT);
Message.Response resp = client.execute(query);
assertNull(resp.getWarnings());
}
}
示例6: execute
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
List<String> cqlVersions = new ArrayList<String>();
cqlVersions.add(QueryProcessor.CQL_VERSION.toString());
List<String> compressions = new ArrayList<String>();
if (FrameCompressor.SnappyCompressor.instance != null)
compressions.add("snappy");
Map<String, List<String>> supported = new HashMap<String, List<String>>();
supported.put(StartupMessage.CQL_VERSION, cqlVersions);
supported.put(StartupMessage.COMPRESSION, compressions);
return new SupportedMessage(supported);
}
示例7: execute
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
try
{
state.getClientState().login(credentials);
return new ReadyMessage();
}
catch (AuthenticationException e)
{
return ErrorMessage.fromException(e);
}
}
示例8: ReadyMessage
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public ReadyMessage()
{
super(Message.Type.READY);
}
示例9: AuthChallenge
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public AuthChallenge(byte[] token)
{
super(Message.Type.AUTH_CHALLENGE);
this.token = token;
}
示例10: ErrorMessage
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
private ErrorMessage(TransportException error)
{
super(Message.Type.ERROR);
this.error = error;
}
示例11: AuthResponse
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public AuthResponse(byte[] token)
{
super(Message.Type.AUTH_RESPONSE);
this.token = token;
}
示例12: EventMessage
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public EventMessage(Event event)
{
super(Message.Type.EVENT);
this.event = event;
this.setStreamId(-1);
}
示例13: OptionsMessage
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public OptionsMessage()
{
super(Message.Type.OPTIONS);
}
示例14: AuthSuccess
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
public AuthSuccess(byte[] token)
{
super(Message.Type.AUTH_SUCCESS);
this.token = token;
}
示例15: CredentialsMessage
import org.apache.cassandra.transport.Message; //导入依赖的package包/类
private CredentialsMessage(Map<String, String> credentials)
{
super(Message.Type.CREDENTIALS);
this.credentials = credentials;
}