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


Java EndpointState类代码示例

本文整理汇总了Java中org.apache.qpid.proton.engine.EndpointState的典型用法代码示例。如果您正苦于以下问题:Java EndpointState类的具体用法?Java EndpointState怎么用?Java EndpointState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EndpointState类属于org.apache.qpid.proton.engine包,在下文中一共展示了EndpointState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void bind(Connection conn)
{
    // TODO - check if already bound

    _connectionEndpoint = (ConnectionImpl) conn;
    put(Event.Type.CONNECTION_BOUND, conn);
    _connectionEndpoint.setTransport(this);
    _connectionEndpoint.incref();

    if(getRemoteState() != EndpointState.UNINITIALIZED)
    {
        _connectionEndpoint.handleOpen(_open);
        if(getRemoteState() == EndpointState.CLOSED)
        {
            _connectionEndpoint.setRemoteState(EndpointState.CLOSED);
        }

        _frameParser.flush();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:TransportImpl.java

示例2: handleEnd

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void handleEnd(End end, Binary payload, Integer channel)
{
    TransportSession transportSession = _remoteSessions.get(channel);
    if(transportSession == null)
    {
        // TODO - fail due to attach on non-begun session
    }
    else
    {
        _remoteSessions.remove(channel);
        transportSession.receivedEnd();
        transportSession.unsetRemoteChannel();
        SessionImpl session = transportSession.getSession();
        session.setRemoteState(EndpointState.CLOSED);
        ErrorCondition errorCondition = end.getError();
        if(errorCondition != null)
        {
            session.getRemoteCondition().copyFrom(errorCondition);
        }

        _connectionEndpoint.put(Event.Type.SESSION_REMOTE_CLOSE, session);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:25,代码来源:TransportImpl.java

示例3: handleClose

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void handleClose(Close close, Binary payload, Integer channel)
{
    _closeReceived = true;
    _remoteIdleTimeout = 0;
    setRemoteState(EndpointState.CLOSED);
    if(_connectionEndpoint != null)
    {
        _connectionEndpoint.setRemoteState(EndpointState.CLOSED);
        if(close.getError() != null)
        {
            _connectionEndpoint.getRemoteCondition().copyFrom(close.getError());
        }

        _connectionEndpoint.put(Event.Type.CONNECTION_REMOTE_CLOSE, _connectionEndpoint);
    }

}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:TransportImpl.java

示例4: send

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public int send(final byte[] bytes, int offset, int length)
{
    if (getLocalState() == EndpointState.CLOSED)
    {
        throw new IllegalStateException("send not allowed after the sender is closed.");
    }
    DeliveryImpl current = current();
    if (current == null || current.getLink() != this)
    {
        throw new IllegalArgumentException();//TODO.
    }
    int sent = current.send(bytes, offset, length);
    if (sent > 0) {
        getSession().incrementOutgoingBytes(sent);
    }
    return sent;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:SenderImpl.java

示例5: test

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Test
public void test()
{
    Connection connection1 = Proton.connection();
    Connection connection2 = Proton.connection();;
    Transport transport1 = Proton.transport();
    transport1.bind(connection1);

    Transport transport2 = Proton.transport();
    transport2.bind(connection2);

    assertEquals(EndpointState.UNINITIALIZED, connection1.getLocalState());
    assertEquals(EndpointState.UNINITIALIZED, connection1.getRemoteState());

    connection1.open();
    connection2.open();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:SimpleTest.java

示例6: processEventSessionRemoteState

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
private void processEventSessionRemoteState(Event event) {
    final String methodName = "processEventSessionRemoteState";
    logger.entry(this, methodName, event);

    if (event.getSession().getRemoteState() == EndpointState.ACTIVE) {
        if (event.getSession().getLocalState() == EndpointState.ACTIVE) {
            final EngineConnection engineConnection =
                    (EngineConnection) event.getConnection().getContext();
            if (!engineConnection.closed) {
                // First session has opened on the connection
                OpenRequest req = engineConnection.openRequest;
                engineConnection.openRequest = null;
                engineConnection.requestor.tell(new OpenResponse(req, engineConnection), this);
            }
        } else {
            // The remote end is trying to establish a new session with us, which is not allowed. I don't think this is a usual case,
            // but could occur with a badly written remote end (i.e. sends an initial AMQP open immediately followed by a begin)
            final Connection protonConnection = event.getConnection();
            protonConnection.setCondition(new ErrorCondition(Symbol.getSymbol("mqlight:session-remote-open-rejected"),
                                                             "MQ Light client is unable to accept an open session request"));
            protonConnection.close();
        }
    }

    logger.exit(this, methodName);
}
 
开发者ID:mqlight,项目名称:java-mqlight,代码行数:27,代码来源:Engine.java

示例7: detach

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void detach(AsyncResult request) {
   // If already closed signal success or else the caller might never get notified.
   if (getEndpoint().getLocalState() == EndpointState.CLOSED || getEndpoint().getRemoteState() == EndpointState.CLOSED) {

      if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
         doDetach();
         getEndpoint().free();
      }

      request.onSuccess();
   } else {
      this.closeRequest = request;
      doDetach();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AmqpAbstractResource.java

示例8: close

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void close(AsyncResult request) {
   // If already closed signal success or else the caller might never get notified.
   if (getEndpoint().getLocalState() == EndpointState.CLOSED || getEndpoint().getRemoteState() == EndpointState.CLOSED) {

      if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
         doClose();
         getEndpoint().free();
      }

      request.onSuccess();
   } else {
      this.closeRequest = request;
      doClose();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AmqpAbstractResource.java

示例9: tick

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
public long tick(boolean firstTick) {
   lock.lock();
   try {
      if (!firstTick) {
         try {
            if (connection.getLocalState() != EndpointState.CLOSED) {
               long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
               if (transport.isClosed()) {
                  throw new IllegalStateException("Channel was inactive for to long");
               }
               return rescheduleAt;
            }
         } catch (Exception e) {
            log.warn(e.getMessage(), e);
            transport.close();
            connection.setCondition(new ErrorCondition());
         }
         return 0;
      }
      return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
   } finally {
      lock.unlock();
      flushBytes();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:ProtonHandler.java

示例10: processStateChange

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void processStateChange() throws IOException {
    EndpointState remoteState = endpoint.getRemoteState();

    if (remoteState == EndpointState.ACTIVE) {
        if (isAwaitingOpen()) {
            LOG.debug("Link {} is now open: ", this);
            opened();
        }

        // Should not receive an ACTIVE event if not awaiting the open state.
    } else if (remoteState == EndpointState.CLOSED) {
        if (isAwaitingClose()) {
            LOG.debug("Link {} is now closed: ", this);
            closed();
        } else if (isAwaitingOpen()) {
            // Error on Open, create exception and signal failure.
            LOG.warn("Open of link {} failed: ", this);
            Exception remoteError = this.getRemoteError();
            failed(remoteError);
        } else {
            // TODO - Handle remote asynchronous close.
        }
    }
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:26,代码来源:AbstractAmqpResource.java

示例11: performConnectionOpen

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
private void performConnectionOpen(Connection connection, InputStream in, OutputStream out) throws IOException, LoginException {
    connection.setHostname(saslHostname);
    connection.setContainer(container);
    connection.open();
    writeToNetwork(connection, out);
    readFromNetwork(connection, in, () -> connection.getRemoteState() == EndpointState.UNINITIALIZED);
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:8,代码来源:SaslDelegatingLogin.java

示例12: onConnectionRemoteOpen

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void onConnectionRemoteOpen(Event evt) {
    Connection conn = evt.getConnection();
    if (conn.getLocalState() == EndpointState.UNINITIALIZED) {
        conn.open();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Handshaker.java

示例13: onSessionRemoteOpen

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void onSessionRemoteOpen(Event evt) {
    Session ssn = evt.getSession();
    if (ssn.getLocalState() == EndpointState.UNINITIALIZED) {
        ssn.open();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Handshaker.java

示例14: onLinkRemoteOpen

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void onLinkRemoteOpen(Event evt) {
    Link link = evt.getLink();
    if (link.getLocalState() == EndpointState.UNINITIALIZED) {
        link.setSource(link.getRemoteSource());
        link.setTarget(link.getRemoteTarget());
        link.open();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:10,代码来源:Handshaker.java

示例15: onConnectionRemoteClose

import org.apache.qpid.proton.engine.EndpointState; //导入依赖的package包/类
@Override
public void onConnectionRemoteClose(Event evt) {
    Connection conn = evt.getConnection();
    if (conn.getLocalState() != EndpointState.CLOSED) {
        conn.close();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:8,代码来源:Handshaker.java


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