use of org.apache.ignite.spi.communication.tcp.TcpCommunicationMetricsListener 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;
}
Aggregations