Java Code Examples for reactor.netty.ConnectionObserver#State

The following examples show how to use reactor.netty.ConnectionObserver#State . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpTrafficHandler.java    From reactor-netty with Apache License 2.0 5 votes vote down vote up
void sendNewState(Connection connection, ConnectionObserver.State state) {
	ChannelOperations<?, ?> ops = connection.as(ChannelOperations.class);
	if (ops != null) {
		listener.onStateChange(ops, state);
	}
	else {
		listener.onStateChange(connection, state);
	}
}
 
Example 2
Source File: HttpServerHandleStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean validate(Object[] args) {
    if (args == null || args.length < 2) {
        return false;
    }

    if (!(args[1] instanceof ConnectionObserver.State)) {
        return false;
    }

    return true;
}
 
Example 3
Source File: HttpServerHandleStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean isReceived(Object[] args) {
    if (!validate(args)) {
        return false;
    }

    ConnectionObserver.State state = (ConnectionObserver.State) args[1];
    if (state != ConnectionObserver.State.CONFIGURED) {
        return false;
    }

    return true;
}
 
Example 4
Source File: HttpServerHandleStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean isDisconnecting(Object[] args) {
    if (!validate(args)) {
        return false;
    }

    ConnectionObserver.State state = (ConnectionObserver.State) args[1];
    if (state != ConnectionObserver.State.DISCONNECTING) {
        return false;
    }

    return true;
}
 
Example 5
Source File: HttpServerHandleHttpServerStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean validate(Object[] args) {
    if (args == null || args.length < 2) {
        return false;
    }

    if (!(args[1] instanceof ConnectionObserver.State)) {
        return false;
    }

    return true;
}
 
Example 6
Source File: HttpServerHandleHttpServerStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean isReceived(Object[] args) {
    if (!validate(args)) {
        return false;
    }
    ConnectionObserver.State state = (ConnectionObserver.State) args[1];
    if (state != HttpServerState.REQUEST_RECEIVED) {
        return false;
    }
    return true;
}
 
Example 7
Source File: HttpServerHandleHttpServerStateInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public boolean isDisconnecting(Object[] args) {
    if (!validate(args)) {
        return false;
    }
    ConnectionObserver.State state = (ConnectionObserver.State) args[1];
    if (state != HttpServerState.DISCONNECTING) {
        return false;
    }
    return true;
}
 
Example 8
Source File: CompositeGatewayObserver.java    From Discord4J with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onStateChange(ConnectionObserver.State newState, GatewayClient gatewayClient) {
    for (GatewayObserver observer : observers) {
        observer.onStateChange(newState, gatewayClient);
    }
}
 
Example 9
Source File: DefaultGatewayClient.java    From Discord4J with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void notifyObserver(ConnectionObserver.State state) {
    observer.onStateChange(state, this);
}
 
Example 10
Source File: GatewayObserver.java    From Discord4J with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * React on websocket state change.
 *
 * @param newState the new state
 * @param client the gateway client observing this change
 */
void onStateChange(ConnectionObserver.State newState, GatewayClient client);