File: Bundling.txt

package info (click to toggle)
libjgroups-java 2.12.2.Final-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,712 kB
  • sloc: java: 109,098; xml: 9,423; sh: 149; makefile: 2
file content (78 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78



Message bundling
================

// Author: Bela Ban

Init:
-----

- set start = 0
- set wait_time = 0
- set count = 0


On Message:
-----------

- if start == 0:
  - set start = current time

- if msg.length + count >= max_bundle_size:
  - send all messages
  - set count = 0
  - set start = current time

- add message
- set count = count + msg.length

- compute new wait_time: max_bundle_time - (current time - start)
- if wait_time <= 0:
  - send all messages
  - Init()


On Timeout:
-----------

- send all messages
- Init()


New implementation (Nov 2005)
=============================
- done in TP.send(), this way message bundling and using a separate thread for sending
  messages are orthogonal issues

Variables:
----------
- queue, queue size

On send():
----------
- if msg size + queue size >= max_size:
    - cancel timer
    - bundle and send queued msgs
    - clear queue
- add msg to queue
- if timer is not running: start timer

On timer timeout:
-----------------
- bundle and send queued msgs (if any)
- clear queue