JAVA登陆Window Server Active Directory并搜索用户信息以及组信息(二)
/*
* 重新连接
*/
public synchronized boolean reConn(){
System.out.println("重新连接");
boolean flag = false;
try {
this.dirContext = this.createConnection();
flag = true;
} catch (RuntimeException e) {
flag = false;
}
return flag;
}
/*
* 关闭连接
*/
public synchronized void close() {
if (this.dirContext != null) {
try {
this.dirContext.close();
utillong = null;
} catch (NamingException e) {
System.out.println("NamingException in close():" + e);
}
}
}
}