Skip to content

Hide Recycler implemention to allow experimenting with different impl… - #9715

Merged
normanmaurer merged 1 commit into
4.1from
recycler_pluggable
Oct 26, 2019
Merged

normanmaurer merged 1 commit into
4.1from
recycler_pluggable

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

…ementions of an Object pool

Motivation:

At the moment we directly extend the Recycler base class in our code which makes it hard to experiment with different Object pool implementation. It would be nice to be able to switch from one to another by using a system property in the future. This would also allow to more easily test things like #8052.

Modifications:

  • Introduce ObjectPool class with static method that we now use internally to obtain an ObjectPool implementation.
  • Wrap the Recycler into an ObjectPool and return it for now

Result:

Preparation for different ObjectPool implementations

…ementions of an Object pool

Motivation:

At the moment we directly extend the Recycler base class in our code which makes it hard to experiment with different Object pool implementation. It would be nice to be able to switch from one to another by using a system property in the future. This would also allow to more easily test things like #8052.

Modifications:

- Introduce ObjectPool class with static method that we now use internally to obtain an ObjectPool implementation.
- Wrap the Recycler into an ObjectPool and return it for now

Result:

Preparation for different ObjectPool implementations
public static <T> ObjectPool<T> newPool(final ObjectCreator<T> creator) {
ObjectUtil.checkNotNull(creator, "creator");

return new RecyclerObjectPool<T>(creator);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will add more implementations here then which will be selected based on a system property.

@normanmaurer

Copy link
Copy Markdown
Member Author

@netty-bot test this please

@carl-mastrangelo carl-mastrangelo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@normanmaurer
normanmaurer merged commit 6c061ab into 4.1 Oct 26, 2019
@normanmaurer
normanmaurer deleted the recycler_pluggable branch October 26, 2019 07:34
normanmaurer added a commit that referenced this pull request Oct 26, 2019
…ementions of an Object pool (#9715)

Motivation:

At the moment we directly extend the Recycler base class in our code which makes it hard to experiment with different Object pool implementation. It would be nice to be able to switch from one to another by using a system property in the future. This would also allow to more easily test things like #8052.

Modifications:

- Introduce ObjectPool class with static method that we now use internally to obtain an ObjectPool implementation.
- Wrap the Recycler into an ObjectPool and return it for now

Result:

Preparation for different ObjectPool implementations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants