Connection connection = null;
    try {
        connection = new Connection();
        connection.connect();
        .... // ЗДЕСЬ БИЗНЕС ЛОГИКА, ВСЕ ОСТАЛЬНОЕ ОДИНАКОВОЕ В КАЖДОМ МЕТОДЕ (КРОМЕ СООБЩЕНИЙ ЛОГГЕРА)

    }  catch (OrgStructServiceException ose) {
        throw ose;
    } catch (Exception e) {
        throw new OrgStructServiceException("re", e);
    } finally {
        if (connection != null) {
                connection.disconnect();
        }
    }

Add a code snippet to your website: www.paste.org