Skip to content

Commit 4399e69

Browse files
authored
Update README.md
1 parent 094ebf4 commit 4399e69

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@ Objects borrowed from OPPool have following basic lifecycle:
1212
4. When objects is no longer usable (some lifecycle operation fails) or needed it is destroyed.
1313

1414
To create pool for of OrderedCollections one could write:
15-
OPBasicPool new
16-
creator: [OrderedCollection new].
17-
15+
```Smalltalk
16+
OPBasicPool new
17+
creator: [OrderedCollection new].
18+
```
1819
To get new collection from the pool:
19-
pool withPooled: [:o| "Do something"].
20-
20+
```Smalltalk
21+
pool withPooled: [:o| "Do something"].
22+
```
2123
To also clear collections when they are returned add passivator
22-
pool passivator:[:o|o removeAll].
23-
24+
```Smalltalk
25+
pool passivator:[:o|o removeAll].
26+
```
2427
Or to do that before borrow add activator:
25-
pool activator:[:o|o removeAll].
26-
28+
```Smalltalk
29+
pool activator:[:o|o removeAll].
30+
```
2731
To validate objets before borrow add following. Objects that do not validate are destroyed.
28-
pool validator:[:o|o size = 0].
29-
32+
```Smalltalk
33+
pool validator:[:o|o size = 0].
34+
```
3035
One can set maximum size of pool with #maxIdleIbjects. See more about pool configuration
3136
in documentation of OPBasicPool.

0 commit comments

Comments
 (0)