hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Lazy init of cookie specs
Date Tue, 09 Sep 2014 12:39:27 GMT
Would it not be simpler to use the IODH idiom for the lazy init?

For example:

public class IgnoreSpecProvider implements CookieSpecProvider {

    public IgnoreSpecProvider() {
        super();
    }

    @Override
    public CookieSpec create(final HttpContext context) {
        return IgnoreSpec.getInstance();
    }

}

public class IgnoreSpec extends CookieSpecBase {

    private static class SpecHolder {
        private static final IgnoreSpec INSTANCE = new IgnoreSpec();
    }

    public static IgnoreSpec getInstance() {
        return SpecHolder.INSTANCE;
    }

    private IgnoreSpec() { // prevent external init (not strictly necessary)
        super();
    }

.... rest of class
}

Just a thought.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message