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


Java Symbol.getSymbol方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:SymbolType.java

示例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());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:34,代码来源:ConnectionTest.java

示例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());
}
 
开发者ID:strimzi,项目名称:amqp-kafka-bridge,代码行数:7,代码来源:AmqpErrorConditionException.java

示例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;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:65,代码来源:TransportImpl.java

示例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));
}
 
开发者ID:eclipse,项目名称:hono,代码行数:11,代码来源:AmqpErrorException.java

示例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);
}
 
开发者ID:strimzi,项目名称:amqp-kafka-bridge,代码行数:11,代码来源:AmqpBridge.java


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