com.unboundid.ldap.sdk.LDAPConnection.getConnectTime()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中com.unboundid.ldap.sdk.LDAPConnection.getConnectTime()方法的一些代码示例,展示了LDAPConnection.getConnectTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.getConnectTime()方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.LDAPConnection
类名称:LDAPConnection
方法名:getConnectTime

LDAPConnection.getConnectTime介绍

[英]Retrieves the time that this connection was established in the number of milliseconds since January 1, 1970 UTC (the same format used by System.currentTimeMillis.
[中]检索自UTC 1970年1月1日以来建立此连接的时间(与System.currentTimeMillis使用的格式相同),以毫秒为单位。

代码示例

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

/**
 * Retrieves the time that this connection was last used to send or receive an
 * LDAP message.  The value will represent the number of milliseconds since
 * January 1, 1970 UTC (the same format used by
 * {@code System.currentTimeMillis}.
 *
 * @return  The time that this connection was last used to send or receive an
 *          LDAP message.  If the connection is not established, then -1 will
 *          be returned.  If the connection is established but no
 *          communication has been performed over the connection since it was
 *          established, then the value of {@link #getConnectTime()} will be
 *          returned.
 */
public long getLastCommunicationTime()
{
 if (lastCommunicationTime > 0L)
 {
  return lastCommunicationTime;
 }
 else
 {
  return getConnectTime();
 }
}

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition

/**
 * Retrieves the time that this connection was last used to send or receive an
 * LDAP message.  The value will represent the number of milliseconds since
 * January 1, 1970 UTC (the same format used by
 * {@code System.currentTimeMillis}.
 *
 * @return  The time that this connection was last used to send or receive an
 *          LDAP message.  If the connection is not established, then -1 will
 *          be returned.  If the connection is established but no
 *          communication has been performed over the connection since it was
 *          established, then the value of {@code getConnectTime()} will be
 *          returned.
 */
public long getLastCommunicationTime()
{
 if (lastCommunicationTime > 0L)
 {
  return lastCommunicationTime;
 }
 else
 {
  return getConnectTime();
 }
}

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

/**
 * Indicates whether the provided connection should be considered expired.
 *
 * @param  connection  The connection for which to make the determination.
 *
 * @return  {@code true} if the provided connection should be considered
 *          expired, or {@code false} if not.
 */
private boolean connectionIsExpired(final LDAPConnection connection)
{
 // If connection expiration is not enabled, then there is nothing to do.
 if (maxConnectionAge <= 0L)
 {
  return false;
 }
 // If there is a minimum disconnect interval, then make sure that we have
 // not closed another expired connection too recently.
 final long currentTime = System.currentTimeMillis();
 if ((currentTime - lastExpiredDisconnectTime) < minDisconnectInterval)
 {
  return false;
 }
 // Get the age of the connection and see if it is expired.
 final long connectionAge = currentTime - connection.getConnectTime();
 return (connectionAge > maxConnectionAge);
}

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition

final long connectionAge = currentTime - connection.getConnectTime();
return (connectionAge > maxAge);

代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition

final long connectionAge = currentTime - connection.getConnectTime();
return (connectionAge > maxAge);

相关文章

LDAPConnection类方法