java.sql.DriverManager#getLoginTimeout ( )源码实例Demo

下面列出了java.sql.DriverManager#getLoginTimeout ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bigtable-sql   文件: OpenConnectionCommand.java
private void awaitConnection(Future future, final OpenConnectionCommandListener openConnectionCommandListener)
{
   try
   {
      if (0 < DriverManager.getLoginTimeout())
      {
         future.get(DriverManager.getLoginTimeout(), TimeUnit.SECONDS);
      }
      else
      {
         future.get();
      }

      SwingUtilities.invokeLater(new Runnable()
      {
         public void run()
         {
            openConnectionCommandListener.openConnectionFinished(null);
         }
      });
   }
   catch (final Throwable t)
   {
      SwingUtilities.invokeLater(new Runnable()
      {
         public void run()
         {
            openConnectionCommandListener.openConnectionFinished(t);
         }
      });
   }
}
 
源代码2 项目: bigtable-sql   文件: SquirrelPreferences.java
private void loadDefaults()
{
	if (_loginTimeout == -1)
	{
		_loginTimeout = DriverManager.getLoginTimeout();
	}
}
 
源代码3 项目: oxygen   文件: SimpleDataSource.java
@Override
public int getLoginTimeout() {
  return DriverManager.getLoginTimeout();
}
 
源代码4 项目: ZhihuSpider   文件: UnpooledDataSource.java
public int getLoginTimeout() throws SQLException {
	return DriverManager.getLoginTimeout();
}
 
源代码5 项目: gemfirexd-oss   文件: ClientService.java
public ClientService(String host, int port, OpenConnectionArgs connArgs)
    throws GFXDException {
  this.isOpen = false;

  Thread currentThread = Thread.currentThread();
  connArgs.setClientHostName(hostName).setClientID(
      hostId + '|' + currentThread.getName() + "<0x"
          + Long.toHexString(currentThread.getId()) + '>');

  HostAddress hostAddr = ThriftUtils.getHostAddress(host, port);
  this.currentHostConnection = null;
  this.connArgs = connArgs;

  Map<String, String> props = connArgs.getProperties();
  String propValue;
  // default for load-balance is true
  this.loadBalance = (props == null || !"false".equalsIgnoreCase(props
      .remove(ClientAttribute.LOAD_BALANCE)));

  // setup the original host list
  if (props != null && (propValue = props.remove(
      ClientAttribute.SECONDARY_LOCATORS)) != null) {
    this.connHosts = new ArrayList<HostAddress>(4);
    this.connHosts.add(hostAddr);
    final int[] portHolder = new int[1];
    SharedUtils.splitCSV(propValue, addHostAddresses, this.connHosts,
        portHolder);
  }
  else {
    this.connHosts = Collections.singletonList(hostAddr);
  }

  // read the server groups to use for connection
  if (props != null
      && (propValue = props.remove(ClientAttribute.SERVER_GROUPS)) != null) {
    @SuppressWarnings("unchecked")
    Set<String> groupsSet = new THashSet(4);
    SharedUtils.splitCSV(propValue, SharedUtils.stringAggregator,
        groupsSet, Boolean.TRUE);
    this.serverGroups = Collections.unmodifiableSet(groupsSet);
  }
  else {
    this.serverGroups = null;
  }

  this.socketParams = new SocketParameters();
  // initialize read-timeout with DriverManager login timeout first
  int loginTimeout = DriverManager.getLoginTimeout();
  if (loginTimeout != 0) {
    SocketParameters.Param.READ_TIMEOUT.setParameter(this.socketParams,
        Integer.toString(loginTimeout));
  }
  // now check for the protocol details like SSL etc and thus get the required
  // GemFireXD ServerType
  boolean binaryProtocol = false;
  boolean useSSL = false;
  if (props != null) {
    binaryProtocol = Boolean.parseBoolean(props
        .remove(ClientAttribute.THRIFT_USE_BINARY_PROTOCOL));
    useSSL = Boolean.parseBoolean(props.remove(ClientAttribute.SSL));
    // set SSL properties (csv format) into SSL params in SocketParameters
    propValue = props.remove(ClientAttribute.THRIFT_SSL_PROPERTIES);
    if (propValue != null) {
      useSSL = true;
      ThriftUtils.getSSLParameters(this.socketParams, propValue);
    }
    // parse remaining properties like socket buffer sizes, read timeout
    // and keep alive settings
    for (SocketParameters.Param p : SocketParameters.getAllParamsNoSSL()) {
      propValue = (String)props.remove(p.getPropertyName());
      if (propValue != null) {
        p.setParameter(this.socketParams, propValue);
      }
    }
  }
  this.socketParams.setServerType(ServerType.getServerType(true,
      binaryProtocol, useSSL));

  connArgs.setProperties(props);

  openConnection(hostAddr, null);
}
 
源代码6 项目: mybaties   文件: PooledDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
  return DriverManager.getLoginTimeout();
}
 
源代码7 项目: mybaties   文件: UnpooledDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
  return DriverManager.getLoginTimeout();
}
 
源代码8 项目: gemfirexd-oss   文件: ClientService.java
public ClientService(String host, int port, OpenConnectionArgs connArgs)
    throws GFXDException {
  this.isOpen = false;

  Thread currentThread = Thread.currentThread();
  connArgs.setClientHostName(hostName).setClientID(
      hostId + '|' + currentThread.getName() + "<0x"
          + Long.toHexString(currentThread.getId()) + '>');

  HostAddress hostAddr = ThriftUtils.getHostAddress(host, port);
  this.currentHostConnection = null;
  this.connArgs = connArgs;

  Map<String, String> props = connArgs.getProperties();
  String propValue;
  // default for load-balance is true
  this.loadBalance = (props == null || !"false".equalsIgnoreCase(props
      .remove(ClientAttribute.LOAD_BALANCE)));

  // setup the original host list
  if (props != null && (propValue = props.remove(
      ClientAttribute.SECONDARY_LOCATORS)) != null) {
    this.connHosts = new ArrayList<HostAddress>(4);
    this.connHosts.add(hostAddr);
    final int[] portHolder = new int[1];
    SharedUtils.splitCSV(propValue, addHostAddresses, this.connHosts,
        portHolder);
  }
  else {
    this.connHosts = Collections.singletonList(hostAddr);
  }

  // read the server groups to use for connection
  if (props != null
      && (propValue = props.remove(ClientAttribute.SERVER_GROUPS)) != null) {
    @SuppressWarnings("unchecked")
    Set<String> groupsSet = new THashSet(4);
    SharedUtils.splitCSV(propValue, SharedUtils.stringAggregator,
        groupsSet, Boolean.TRUE);
    this.serverGroups = Collections.unmodifiableSet(groupsSet);
  }
  else {
    this.serverGroups = null;
  }

  this.socketParams = new SocketParameters();
  // initialize read-timeout with DriverManager login timeout first
  int loginTimeout = DriverManager.getLoginTimeout();
  if (loginTimeout != 0) {
    SocketParameters.Param.READ_TIMEOUT.setParameter(this.socketParams,
        Integer.toString(loginTimeout));
  }
  // now check for the protocol details like SSL etc and thus get the required
  // GemFireXD ServerType
  boolean binaryProtocol = false;
  boolean useSSL = false;
  if (props != null) {
    binaryProtocol = Boolean.parseBoolean(props
        .remove(ClientAttribute.THRIFT_USE_BINARY_PROTOCOL));
    useSSL = Boolean.parseBoolean(props.remove(ClientAttribute.SSL));
    // set SSL properties (csv format) into SSL params in SocketParameters
    propValue = props.remove(ClientAttribute.THRIFT_SSL_PROPERTIES);
    if (propValue != null) {
      useSSL = true;
      ThriftUtils.getSSLParameters(this.socketParams, propValue);
    }
    // parse remaining properties like socket buffer sizes, read timeout
    // and keep alive settings
    for (SocketParameters.Param p : SocketParameters.getAllParamsNoSSL()) {
      propValue = (String)props.remove(p.getPropertyName());
      if (propValue != null) {
        p.setParameter(this.socketParams, propValue);
      }
    }
  }
  this.socketParams.setServerType(ServerType.getServerType(true,
      binaryProtocol, useSSL));

  connArgs.setProperties(props);

  openConnection(hostAddr, null);
}
 
源代码9 项目: weed3   文件: DbDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
    return DriverManager.getLoginTimeout();
}
 
源代码10 项目: vibur-dbcp   文件: SimpleDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
    return DriverManager.getLoginTimeout();
}
 
public int getLoginTimeout()
{
    return DriverManager.getLoginTimeout();
}
 
源代码12 项目: jaybird   文件: FBManagedConnection.java
FBManagedConnection(FBConnectionRequestInfo cri, FBManagedConnectionFactory mcf) throws SQLException {
    this.mcf = mcf;
    this.cri = getCombinedConnectionRequestInfo(cri);
    this.tpb = mcf.getDefaultTpb();
    this.transactionIsolation = mcf.getDefaultTransactionIsolation();

    //TODO: XIDs in limbo should be loaded so that XAER_DUPID can be thrown appropriately

    DatabaseParameterBuffer dpb = this.cri.getDpb();

    if (dpb.getArgumentAsString(DatabaseParameterBuffer.LC_CTYPE) == null
            && dpb.getArgumentAsString(DatabaseParameterBufferExtension.LOCAL_ENCODING) == null) {
        String defaultEncoding = getDefaultConnectionEncoding();
        if (defaultEncoding == null) {
            throw new SQLNonTransientConnectionException(ERROR_NO_CHARSET,
                    SQLStateConstants.SQL_STATE_CONNECTION_ERROR);
        }
        dpb.addArgument(DatabaseParameterBuffer.LC_CTYPE, defaultEncoding);

        String warningMessage = WARNING_NO_CHARSET + defaultEncoding;
        log.warn(warningMessage);
        notifyWarning(new SQLWarning(warningMessage));
    }

    if (!dpb.hasArgument(DatabaseParameterBuffer.CONNECT_TIMEOUT) && DriverManager.getLoginTimeout() > 0) {
        dpb.addArgument(DatabaseParameterBuffer.CONNECT_TIMEOUT, DriverManager.getLoginTimeout());
    }

    final FbConnectionProperties connectionProperties = new FbConnectionProperties();
    connectionProperties.fromDpb(dpb);
    // TODO Move this logic to the GDSType or database factory?
    final String gdsTypeName = mcf.getGDSType().toString();
    if (!(EmbeddedGDSFactoryPlugin.EMBEDDED_TYPE_NAME.equals(gdsTypeName)
            || LocalGDSFactoryPlugin.LOCAL_TYPE_NAME.equals(gdsTypeName))) {
        final DbAttachInfo dbAttachInfo = DbAttachInfo.parseConnectString(mcf.getDatabase());
        connectionProperties.setServerName(dbAttachInfo.getServer());
        connectionProperties.setPortNumber(dbAttachInfo.getPort());
        connectionProperties.setDatabaseName(dbAttachInfo.getFileName());
    } else {
        connectionProperties.setDatabaseName(mcf.getDatabase());
    }

    database = mcf.getDatabaseFactory().connect(connectionProperties);
    database.addDatabaseListener(new MCDatabaseListener());
    database.addExceptionListener(this);
    database.attach();
    syncObject = database.getSynchronizationObject();

    gdsHelper = new GDSHelper(database);
}
 
源代码13 项目: doma-gen   文件: SimpleDataSource.java
@Override
public int getLoginTimeout() {
  return DriverManager.getLoginTimeout();
}
 
源代码14 项目: doma   文件: SimpleDataSource.java
@Override
public int getLoginTimeout() {
  return DriverManager.getLoginTimeout();
}
 
源代码15 项目: mybatis   文件: PooledDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
  return DriverManager.getLoginTimeout();
}
 
源代码16 项目: mybatis   文件: UnpooledDataSource.java
@Override
public int getLoginTimeout() throws SQLException {
  return DriverManager.getLoginTimeout();
}