tags:

views:

25

answers:

0

Hello, everybody :)

I got a stubborn problem with the RTMPClient class. I am creating a cluster with red5 and when one server is connecting to another everything is OK. Function calls works fine... Let's say I got ServerA and ServerB. ServerA runs first so ServerB connects to ServerA.. The problem is when ServerA gets stopped - ServerB doesn't know about it.

Here's the code of NetConnection class I wrote to handle things:

public class NetConnection extends RTMPClient
                 implements IPendingServiceCallback, ClientExceptionHandler {
    public NetConnection(String server, int port, Object[] params) {
        this.setServiceProvider(this);
        this.setExceptionHandler(this);
        Map<String, Object> connParams = this.makeDefaultConnectionParams(server, port, appName);
        connect(server, port, connParams, this)
    }

    @Override
    public void resultReceived(IPendingServiceCall call) {
        Object result = call.getResult();
        if(!(result instanceof Map)) {
            App.log.red("NetConnection::resultReceived(): result is !map");
            return;
        }

        @SuppressWarnings("unchecked")
        Map<String, Object> map = (Map<String, Object>) result;
        String code = (String) map.get("code");

        App.log.yellow("NetConnection::onStatus(): " + code);
    }

    public void handleException(Throwable err) {
        err.printStackTrace();
    }
}

The RTMPClient class doesn't call resultRecieved() nor handleException. Any ideas?