use of lucee.runtime.pool.PoolItem in project Lucee by lucee.
the class MailClient method getInstance.
public static MailClient getInstance(int type, String server, int port, String username, String password, boolean secure, String name, String id) throws Exception {
String uid;
if (StringUtil.isEmpty(name))
uid = createName(type, server, port, username, password, secure);
else
uid = name;
uid = type + ";" + uid + ";" + id;
PoolItem item = pool.get(uid);
if (item == null) {
if (StringUtil.isEmpty(server)) {
if (StringUtil.isEmpty(name))
throw new ApplicationException("missing server information");
else
throw new ApplicationException("there is no connection available with name [" + name + "]");
}
if (TYPE_POP3 == type)
pool.put(uid, item = new PopClient(server, port, username, password, secure));
if (TYPE_IMAP == type)
pool.put(uid, item = new ImapClient(server, port, username, password, secure));
}
return (MailClient) item;
}
Aggregations