if (normalClose) { if (!mGoodbyeSent) { sendUntagged(ImapServer.getGoodbye(), true); } mGoodbyeSent = true; } } catch (IOException ioe) { normalClose = false; } finally { if (normalClose) { mConnection.close(); } else { mConnection.closeNow(); } mState = ConnectionState.CLOSED; if (ZimbraLog.imap.isDebugEnabled()) ZimbraLog.imap.debug("entered closed state: normal=" + normalClose); }
} } catch (IOException ioe) { normalClose = false; } finally { if (normalClose) { mConnection.close(); } else { mConnection.closeNow(); } mState = ConnectionState.CLOSED; if (ZimbraLog.imap.isDebugEnabled()) ZimbraLog.imap.debug("entered closed state: normal=" + normalClose);
    private void gotoClosedState(boolean normalClose) {        synchronized (mCloseLock) {        	// Close only once        	if (mState == ConnectionState.CLOSED) {        		throw new IllegalStateException("connection already closed");        	}        	        	try {        		if (mSession != null) {        			mSession.setHandler(null);        			SessionCache.clearSession(mSession.getSessionId(), mSession.getAccountId());        			mSession = null;        		}        		        		if (normalClose) {        			if (!mGoodbyeSent) {        				sendUntagged(ImapServer.getGoodbye(), true);        			}        			mGoodbyeSent = true;        		}        	} catch (IOException ioe) {        		normalClose = false;        	} finally {        		if (normalClose) {        			mConnection.close();        		} else {        			mConnection.closeNow();        		}        		mState = ConnectionState.CLOSED;        		if (ZimbraLog.imap.isDebugEnabled()) ZimbraLog.imap.debug("entered closed state: normal=" + normalClose);        	}        }    }