Skip to content

Commit 3849e7e

Browse files
authored
[BKNDLSS-25452] Before/After event handlers for counters and cache (#499)
1 parent 980e378 commit 3849e7e

File tree

2 files changed

+178
-0
lines changed

2 files changed

+178
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package com.backendless.servercode.extension;
2+
3+
import com.backendless.servercode.ExecutionResult;
4+
import com.backendless.servercode.RunnerContext;
5+
6+
import java.util.Set;
7+
8+
public abstract class AtomicOperationExtender
9+
{
10+
public void beforeReset( RunnerContext context, String counterName ) throws Exception
11+
{
12+
13+
}
14+
15+
public void afterReset( RunnerContext context, String counterName, ExecutionResult<Void> result ) throws Exception
16+
{
17+
18+
}
19+
20+
public void beforeGetAndIncrement( RunnerContext context, String counterName ) throws Exception
21+
{
22+
23+
}
24+
25+
public void afterGetAndIncrement( RunnerContext context, String counterName, ExecutionResult<Long> result ) throws Exception
26+
{
27+
28+
}
29+
30+
public void beforeIncrementAndGet( RunnerContext context, String counterName ) throws Exception
31+
{
32+
33+
}
34+
35+
public void afterIncrementAndGet( RunnerContext context, String counterName, ExecutionResult<Long> result ) throws Exception
36+
{
37+
38+
}
39+
40+
public void beforeDecrementAndGet( RunnerContext context, String counterName ) throws Exception
41+
{
42+
43+
}
44+
45+
public void afterDecrementAndGet( RunnerContext context, String counterName, ExecutionResult<Long> result ) throws Exception
46+
{
47+
48+
}
49+
50+
public void beforeGetAndDecrement( RunnerContext context, String counterName ) throws Exception
51+
{
52+
53+
}
54+
55+
public void afterGetAndDecrement( RunnerContext context, String counterName, ExecutionResult<Long> result ) throws Exception
56+
{
57+
58+
}
59+
60+
public void beforeAddAndGet( RunnerContext context, String counterName, Long value ) throws Exception
61+
{
62+
63+
}
64+
65+
public void afterAddAndGet( RunnerContext context, String counterName, Long value, ExecutionResult<Long> result ) throws Exception
66+
{
67+
68+
}
69+
70+
public void beforeGetAndAdd( RunnerContext context, String counterName, Long value ) throws Exception
71+
{
72+
73+
}
74+
75+
public void afterGetAndAdd( RunnerContext context, String counterName, Long value,
76+
ExecutionResult<Long> result ) throws Exception
77+
{
78+
79+
}
80+
81+
public void beforeGet( RunnerContext context, String counterName ) throws Exception
82+
{
83+
84+
}
85+
86+
public void afterGet( RunnerContext context, String counterName, ExecutionResult<Long> result ) throws Exception
87+
{
88+
89+
}
90+
91+
public void beforeCompareAndSet( RunnerContext context, String counterName, Long expected, Long updated ) throws Exception
92+
{
93+
94+
}
95+
96+
public void afterCompareAndSet( RunnerContext context, String counterName, Long expected, Long updated, ExecutionResult<Boolean> result ) throws Exception
97+
{
98+
99+
}
100+
101+
public void beforeList( RunnerContext context,String pattern ) throws Exception
102+
{
103+
104+
}
105+
106+
public void afterList( RunnerContext context, String pattern, ExecutionResult<Set<String>> result ) throws Exception
107+
{
108+
109+
}
110+
111+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.backendless.servercode.extension;
2+
3+
import com.backendless.servercode.ExecutionResult;
4+
import com.backendless.servercode.RunnerContext;
5+
6+
public abstract class CacheExtender
7+
{
8+
public void beforePut( RunnerContext context, String key, Object value, Integer ttl ) throws Exception
9+
{
10+
11+
}
12+
13+
public void afterPut( RunnerContext context, String key, Object value, Integer ttl, ExecutionResult<Void> result ) throws Exception
14+
{
15+
16+
}
17+
18+
public void beforeGet( RunnerContext context, String key ) throws Exception
19+
{
20+
21+
}
22+
23+
public void afterGet( RunnerContext context, String key, ExecutionResult<Object> result ) throws Exception
24+
{
25+
26+
}
27+
28+
public void beforeContains( RunnerContext context, String key ) throws Exception
29+
{
30+
31+
}
32+
33+
public void afterContains( RunnerContext context, String key, ExecutionResult<Boolean> result ) throws Exception
34+
{
35+
36+
}
37+
38+
public void beforeExpireAt( RunnerContext context, String key, long expireAt ) throws Exception
39+
{
40+
41+
}
42+
43+
public void afterExpireAt( RunnerContext context, String key, ExecutionResult<Void> result ) throws Exception
44+
{
45+
46+
}
47+
48+
public void beforeExpireIn( RunnerContext context, String key, int expireIn ) throws Exception
49+
{
50+
51+
}
52+
53+
public void afterExpireIn( RunnerContext context, String key, ExecutionResult<Void> result ) throws Exception
54+
{
55+
56+
}
57+
58+
public void beforeDelete( RunnerContext context, String key ) throws Exception
59+
{
60+
61+
}
62+
63+
public void afterDelete( RunnerContext context, String key, ExecutionResult<Void> result ) throws Exception
64+
{
65+
66+
}
67+
}

0 commit comments

Comments
 (0)