Search in sources :

Example 1 with FailureType

use of org.apache.ignite.failure.FailureType in project ignite by apache.

the class TxDeadlockOnEntryToStringTest method resolve.

/**
 * The method reference implementation of {@link DependencyResolver}. It adds an additional behavior to {@link
 * InboundConnectionHandler}.
 *
 * @param instance Delegated instance.
 */
private <T> T resolve(T instance) {
    if (instance instanceof InboundConnectionHandler) {
        InboundConnectionHandler hnd = (InboundConnectionHandler) instance;
        return (T) (new InboundConnectionHandler(null, null, null, null, null, null, null, null, null, null, null, null, null, false, null, null) {

            @Override
            public void setNioSrvWrapper(GridNioServerWrapper nioSrvWrapper) {
                hnd.setNioSrvWrapper(nioSrvWrapper);
            }

            @Override
            public void setClientPool(ConnectionClientPool pool) {
                hnd.setClientPool(pool);
            }

            @Override
            public void onSessionWriteTimeout(GridNioSession ses) {
                hnd.onSessionWriteTimeout(ses);
            }

            @Override
            public void onConnected(GridNioSession ses) {
                hnd.onConnected(ses);
            }

            @Override
            public void onMessageSent(GridNioSession ses, Message msg) {
                hnd.onMessageSent(ses, msg);
            }

            @Override
            public void onMessage(GridNioSession ses, Message msg) {
                if (rejectHandshake.get() && msg instanceof HandshakeMessage2) {
                    rejectHandshake.set(false);
                    ses.close();
                    return;
                }
                hnd.onMessage(ses, msg);
            }

            @Override
            public void onFailure(FailureType failureType, Throwable failure) {
                hnd.onFailure(failureType, failure);
            }

            @Override
            public void onDisconnected(GridNioSession ses, @Nullable Exception e) {
                hnd.onDisconnected(ses, e);
            }

            @Override
            public void stop() {
                hnd.stop();
            }

            @Override
            public void communicationWorker(CommunicationWorker commWorker) {
                hnd.communicationWorker(commWorker);
            }

            @Override
            public void onSessionIdleTimeout(GridNioSession ses) {
                hnd.onSessionIdleTimeout(ses);
            }

            @Override
            public void metricsListener(@Nullable TcpCommunicationMetricsListener metricsLsnr) {
                hnd.metricsListener(metricsLsnr);
            }
        });
    }
    return instance;
}
Also used : FailureType(org.apache.ignite.failure.FailureType) GridNioSession(org.apache.ignite.internal.util.nio.GridNioSession) UUIDCollectionMessage(org.apache.ignite.internal.util.UUIDCollectionMessage) Message(org.apache.ignite.plugin.extensions.communication.Message) HandshakeMessage2(org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage2) TcpCommunicationMetricsListener(org.apache.ignite.spi.communication.tcp.TcpCommunicationMetricsListener) GridNioServerWrapper(org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper) CommunicationWorker(org.apache.ignite.spi.communication.tcp.internal.CommunicationWorker) ConnectionClientPool(org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool) InboundConnectionHandler(org.apache.ignite.spi.communication.tcp.internal.InboundConnectionHandler) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

FailureType (org.apache.ignite.failure.FailureType)1 UUIDCollectionMessage (org.apache.ignite.internal.util.UUIDCollectionMessage)1 GridNioSession (org.apache.ignite.internal.util.nio.GridNioSession)1 Message (org.apache.ignite.plugin.extensions.communication.Message)1 TcpCommunicationMetricsListener (org.apache.ignite.spi.communication.tcp.TcpCommunicationMetricsListener)1 CommunicationWorker (org.apache.ignite.spi.communication.tcp.internal.CommunicationWorker)1 ConnectionClientPool (org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool)1 GridNioServerWrapper (org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper)1 InboundConnectionHandler (org.apache.ignite.spi.communication.tcp.internal.InboundConnectionHandler)1 HandshakeMessage2 (org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage2)1 Nullable (org.jetbrains.annotations.Nullable)1