Search in sources :

Example 1 with OChannelBinaryAsynchClientSynch

use of com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClientSynch in project orientdb by orientechnologies.

the class OServerShutdownMain method connect.

public void connect(final int iTimeout) throws IOException {
    // TRY TO CONNECT TO THE RIGHT PORT
    for (int port : networkPort) try {
        channel = new OChannelBinaryAsynchClientSynch(networkAddress, port, null, contextConfig);
        break;
    } catch (Exception e) {
        OLogManager.instance().error(this, "Error on connecting to %s:%d", e, networkAddress, port);
    }
    if (channel == null)
        throw new ONetworkProtocolException("Cannot connect to server host '" + networkAddress + "', ports: " + Arrays.toString(networkPort));
    channel.writeByte(OChannelBinaryProtocol.REQUEST_SHUTDOWN);
    channel.writeInt(0);
    channel.writeString(rootUser);
    channel.writeString(rootPassword);
    channel.flush();
    channel.beginResponse(0, false);
}
Also used : ONetworkProtocolException(com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException) OChannelBinaryAsynchClientSynch(com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClientSynch) ONetworkProtocolException(com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException) IOException(java.io.IOException)

Aggregations

OChannelBinaryAsynchClientSynch (com.orientechnologies.orient.client.binary.OChannelBinaryAsynchClientSynch)1 ONetworkProtocolException (com.orientechnologies.orient.enterprise.channel.binary.ONetworkProtocolException)1 IOException (java.io.IOException)1