Example usage for org.apache.commons.net.ftp FTPClient setConnectTimeout

List of usage examples for org.apache.commons.net.ftp FTPClient setConnectTimeout

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPClient setConnectTimeout.

Prototype

public void setConnectTimeout(int connectTimeout) 

Source Link

Document

Sets the connection timeout in milliseconds, which will be passed to the Socket object's connect() method.

Usage

From source file:org.teiid.resource.adapter.ftp.FtpManagedConnectionFactory.java

private void beforeConnectProcessing(FTPClient client) throws IOException {

    client.configure(this.config);
    if (this.connectTimeout != null) {
        client.setConnectTimeout(this.connectTimeout);
    }/* w ww.  j a v a  2  s  . co  m*/
    if (this.defaultTimeout != null) {
        client.setDefaultTimeout(this.defaultTimeout);
    }
    if (this.dataTimeout != null) {
        client.setDataTimeout(this.dataTimeout);
    }
    client.setControlEncoding(this.controlEncoding);

    if (this.isFtps) {
        FTPSClient ftpsClient = (FTPSClient) client;
        ftpsClient.execPBSZ(0);
        ftpsClient.execPROT(this.execProt);
    }
}