本文整理汇总了Java中org.apache.qpid.proton.amqp.Symbol.getSymbol方法的典型用法代码示例。如果您正苦于以下问题:Java Symbol.getSymbol方法的具体用法?Java Symbol.getSymbol怎么用?Java Symbol.getSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.amqp.Symbol
的用法示例。
在下文中一共展示了Symbol.getSymbol方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decode
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Override
public Symbol decode(DecoderImpl decoder, ByteBuffer buf)
{
Symbol symbol = _symbolCache.get(buf);
if(symbol == null)
{
byte[] bytes = new byte[buf.limit()];
buf.get(bytes);
String str = new String(bytes, ASCII_CHARSET);
symbol = Symbol.getSymbol(str);
_symbolCache.put(ByteBuffer.wrap(bytes), symbol);
}
return symbol;
}
示例2: testCloseConnectionWithErrorCode_causesCloseFrameContainingErrorCodeToBeSent
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
/**
* "each peer MUST write a close frame with a code indicating the reason for closing"
* Also see 2.8.16 Connection Error
*/
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testCloseConnectionWithErrorCode_causesCloseFrameContainingErrorCodeToBeSent()
{
bindAndOpenConnections();
/*
* TODO javadoc for {@link Connection#getCondition()} states null is returned if there is no condition,
* this differs from the implementation of both Proton-c and Proton-j.
*/
assertNull(_clientConnection.getCondition().getCondition());
assertNull(_serverConnection.getCondition().getCondition());
assertNull(_clientConnection.getRemoteCondition().getCondition());
assertNull(_serverConnection.getRemoteCondition().getCondition());
ErrorCondition clientErrorCondition = new ErrorCondition(Symbol.getSymbol("myerror"), "mydescription");
Map info = new HashMap();
info.put(Symbol.getSymbol("simplevalue"), "value");
info.put(Symbol.getSymbol("list"), Arrays.asList("e1", "e2", "e3"));
clientErrorCondition.setInfo(info);
_clientConnection.setCondition(clientErrorCondition);
_clientConnection.close();
_pumper.pumpAll();
assertEquals(clientErrorCondition, _serverConnection.getRemoteCondition());
assertNull(_serverConnection.getCondition().getCondition());
}
示例3: toCondition
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
/**
* Convert this exception into an {@code ErrorCondition}.
*/
public ErrorCondition toCondition() {
return new ErrorCondition(Symbol.getSymbol(this.error), getMessage());
}
示例4: tick
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Override
public long tick(long now)
{
long deadline = 0;
if (_localIdleTimeout > 0) {
if (_localIdleDeadline == 0 || _lastBytesInput != _bytesInput) {
_localIdleDeadline = computeDeadline(now, _localIdleTimeout);
_lastBytesInput = _bytesInput;
} else if (_localIdleDeadline - now <= 0) {
_localIdleDeadline = computeDeadline(now, _localIdleTimeout);
if (_connectionEndpoint != null &&
_connectionEndpoint.getLocalState() != EndpointState.CLOSED) {
ErrorCondition condition =
new ErrorCondition(Symbol.getSymbol("amqp:resource-limit-exceeded"),
"local-idle-timeout expired");
_connectionEndpoint.setCondition(condition);
_connectionEndpoint.setLocalState(EndpointState.CLOSED);
if (!_isOpenSent) {
if ((_sasl != null) && (!_sasl.isDone())) {
_sasl.fail();
}
Open open = new Open();
_isOpenSent = true;
writeFrame(0, open, null, null);
}
if (!_isCloseSent) {
Close close = new Close();
close.setError(condition);
_isCloseSent = true;
writeFrame(0, close, null, null);
}
close_tail();
}
}
deadline = _localIdleDeadline;
}
if (_remoteIdleTimeout != 0 && !_isCloseSent) {
if (_remoteIdleDeadline == 0 || _lastBytesOutput != _bytesOutput) {
_remoteIdleDeadline = computeDeadline(now, _remoteIdleTimeout / 2);
_lastBytesOutput = _bytesOutput;
} else if (_remoteIdleDeadline - now <= 0) {
_remoteIdleDeadline = computeDeadline(now, _remoteIdleTimeout / 2);
if (pending() == 0) {
writeFrame(0, null, null, null);
_lastBytesOutput += pending();
}
}
if(deadline == 0) {
deadline = _remoteIdleDeadline;
} else {
if(_remoteIdleDeadline - _localIdleDeadline <= 0) {
deadline = _remoteIdleDeadline;
} else {
deadline = _localIdleDeadline;
}
}
}
return deadline;
}
示例5: AmqpErrorException
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
/**
* Creates a new exception for an error and description.
*
* @param error The AMQP error to convey in this exception.
* @param description A textual description of the context the error occurred in.
*/
public AmqpErrorException(final String error, final String description) {
super(Objects.requireNonNull(description));
this.error = Symbol.getSymbol(Objects.requireNonNull(error));
}
示例6: newError
import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
/**
* Create a new AMQP error condition
*
* @param error AMQP error
* @param description description for the AMQP error condition
* @return AMQP error condition
*/
static ErrorCondition newError(String error, String description) {
return new ErrorCondition(Symbol.getSymbol(error), description);
}