commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Osipov" <1983-01...@gmx.net>
Subject [POOL2] Pooling mutable objects
Date Fri, 06 Feb 2015 14:00:30 GMT
Hi folks,

I am developing a session pool for an HTTP backend which is requested with the fabulous HttpClient.

The session object is this:

public class RawSession {

	private CookieStore cookieStore;
	private String logId;
	private MutableInt requestId;
	private String clientId;
	private String serverId;

}

There won't be any setters but as you see, the cookie store and mutable int might change.
Additionally, I did not implement any custom equals and hashCode methods.

I have searched the docs and the found and did not find any clear answer which says
that pooled objects have to be immutable. Though, I have found POOL-283 and POOL-284 which
led me to the conclusion that this is a problem because the objects are stored in a map
which relies on equals and hashCode.

Does this ultimately mean that I have to override equals and hashCode and provide some internal,
immutable value something like a UUID? Alternatively, I could retrieve the JSESSIONID from
the
cookie store and use this as a unique value.

Thanks,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message