Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
d0779fd
created dtos
sanzmauro Jun 18, 2020
1048892
Merge pull request #119 from splitio/streaming-dtos
sanzmauro Jun 23, 2020
8f6cbac
parser implementation and tests
sanzmauro Jun 19, 2020
d726697
pr feedback
sanzmauro Jun 22, 2020
43ac1cb
pr feedback
sanzmauro Jun 22, 2020
def2d6c
added Notificatio class
sanzmauro Jun 22, 2020
61d6b48
pr feedback
sanzmauro Jun 24, 2020
d2c3dc4
pr feedback
sanzmauro Jun 26, 2020
ea2181d
pr feedback
sanzmauro Jun 26, 2020
6b6d25d
pr feedback
sanzmauro Jun 26, 2020
c17bce2
Merge pull request #120 from splitio/streaming-parser
sanzmauro Jun 26, 2020
b205d21
Event source client implementation
sanzmauro Jun 19, 2020
57c8ab5
catching exception
sanzmauro Jun 22, 2020
494b853
improvements
sanzmauro Jun 24, 2020
1b81a8c
shade org.glassfish.jersey dependecies
sanzmauro Jun 26, 2020
b58dc8c
Merge pull request #121 from splitio/streaming-sse-integration
sanzmauro Jun 29, 2020
9c52317
auth client implementation
sanzmauro Jun 23, 2020
2375901
added tests
sanzmauro Jun 24, 2020
71b8ca8
removed comment line
sanzmauro Jun 24, 2020
a7f0856
updated json file
sanzmauro Jun 24, 2020
7670e17
test improvement
sanzmauro Jun 24, 2020
ac3909e
pr feedback
sanzmauro Jun 24, 2020
757fd82
added test with wrong token
sanzmauro Jun 24, 2020
cf5d0bf
pr feedbkac
sanzmauro Jun 25, 2020
be7d3ff
wip
sanzmauro Jun 25, 2020
a2c753b
pr feedback
sanzmauro Jun 26, 2020
8992bc3
set jwt null
sanzmauro Jun 26, 2020
d14bd75
wip
sanzmauro Jun 26, 2020
0825f21
Merge pull request #125 from splitio/auth-api-client
sanzmauro Jun 29, 2020
838546f
split worker implementation and test
sanzmauro Jun 25, 2020
63de35a
wip
sanzmauro Jun 25, 2020
4b26efe
removed test
sanzmauro Jun 26, 2020
8dc4ac7
pr feedback
sanzmauro Jun 29, 2020
9c7ed8a
pr feedback
sanzmauro Jun 29, 2020
59c9df1
wip
sanzmauro Jun 29, 2020
639d0d3
testing thread handler approach
sanzmauro Jun 30, 2020
7e753e8
pr feedback
sanzmauro Jun 30, 2020
f4ca3bc
notification processor implementation and tests
sanzmauro Jun 29, 2020
6a8331b
wip
sanzmauro Jun 29, 2020
768da06
improvements
sanzmauro Jun 30, 2020
48e7851
improvements
sanzmauro Jun 30, 2020
7726bd8
removed unnecessary variable
sanzmauro Jun 30, 2020
f5b0a2d
Merge pull request #123 from splitio/splits-worker-implementation
sanzmauro Jul 2, 2020
7f295b6
Merge pull request #127 from splitio/sse-thread-handler
sanzmauro Jul 2, 2020
3ca68cb
Merge pull request #126 from splitio/notification-processor-imp
sanzmauro Jul 2, 2020
4b569b7
sse handler implementation
sanzmauro Jun 29, 2020
7cd7c6b
wip
sanzmauro Jun 30, 2020
63bd6db
improvements
sanzmauro Jun 30, 2020
cf05aa1
improvements and tests
sanzmauro Jun 30, 2020
fbf0d59
wip
sanzmauro Jul 1, 2020
b017dc7
pr feedback
sanzmauro Jul 2, 2020
8bb5c73
Merge pull request #128 from splitio/sse-handler-imp
sanzmauro Jul 2, 2020
7c8788e
segments worker implementation and workers refactor
sanzmauro Jul 1, 2020
b43e113
wip
sanzmauro Jul 2, 2020
01a30b8
removed TODO
sanzmauro Jul 2, 2020
f570817
add test
sanzmauro Jul 2, 2020
e52f499
pr feedback
sanzmauro Jul 15, 2020
e16a3c1
renamed WorkerImp to Worker
sanzmauro Jul 15, 2020
232eb5b
Merge pull request #129 from splitio/segments-wroker-imp
sanzmauro Jul 15, 2020
03e338d
PushManager implementation and tests
sanzmauro Jul 8, 2020
f35e628
updated schedulerExecutorService
sanzmauro Jul 13, 2020
22a9ca8
fixed tests
sanzmauro Jul 13, 2020
b8e446c
pr feedback
sanzmauro Jul 15, 2020
33ff528
Merge pull request #131 from splitio/push-manager-implementation
sanzmauro Jul 16, 2020
783e76a
sync implementation and refactor
sanzmauro Jul 9, 2020
be56e6f
moved pushManager to common package
sanzmauro Jul 9, 2020
f36c927
wip
sanzmauro Jul 9, 2020
34deeab
wip
sanzmauro Jul 13, 2020
257ce5e
wip
sanzmauro Jul 13, 2020
0552668
pr feedback
sanzmauro Jul 16, 2020
c5a9fbb
Merge pull request #130 from splitio/synchronizer
sanzmauro Jul 16, 2020
d5f0a87
sync implementation and refactor
sanzmauro Jul 9, 2020
379972f
notification manager implementation and tests
sanzmauro Jul 14, 2020
23f3cc4
wip
sanzmauro Jul 16, 2020
de03208
undo changes
sanzmauro Jul 16, 2020
bb64080
fix tests
sanzmauro Jul 16, 2020
c368403
pr feedback and added tests
sanzmauro Jul 16, 2020
485c308
pr feedback
sanzmauro Jul 16, 2020
4a4715d
pr feedback
sanzmauro Jul 17, 2020
a616b07
sync implementation and refactor
sanzmauro Jul 9, 2020
27c1fba
sync manager implementation
sanzmauro Jul 14, 2020
eaa6970
improvements
sanzmauro Jul 15, 2020
1f7645a
fix build
sanzmauro Jul 16, 2020
b81d300
added test
sanzmauro Jul 16, 2020
c90b537
fix typo
sanzmauro Jul 16, 2020
c3a09d4
added checkNotNull
sanzmauro Jul 17, 2020
4faf71d
added checkNotNull
sanzmauro Jul 17, 2020
9d903c2
undo changes
sanzmauro Jul 17, 2020
dd6b395
Merge pull request #135 from splitio/sync-manager-imp
sanzmauro Jul 28, 2020
5a648d8
Merge pull request #132 from splitio/notification-manger-keeper
sanzmauro Jul 28, 2020
7103439
feedback loop implementation
sanzmauro Jul 16, 2020
649aef7
added tests
sanzmauro Jul 16, 2020
d655faa
added checkNotNull validation
sanzmauro Jul 17, 2020
f2e4287
improvements
sanzmauro Jul 22, 2020
17f21d0
added tests
sanzmauro Jul 28, 2020
7b188c4
Merge pull request #136 from splitio/push-feedback-loop
sanzmauro Jul 28, 2020
41e6372
Merge pull request #137 from splitio/polishing-check-not-null
sanzmauro Jul 28, 2020
944c3c3
updated configs and add SyncManager builder in factory
sanzmauro Jul 22, 2020
46c4449
pr feedback
sanzmauro Jul 28, 2020
a2ba2cf
pr feedback
sanzmauro Jul 28, 2020
1002849
pr feedback
sanzmauro Jul 28, 2020
25c9036
Merge pull request #138 from splitio/update-factory-configs
sanzmauro Jul 28, 2020
5870998
polishing logs and improvements
sanzmauro Jul 28, 2020
ef3b6d8
improvements
sanzmauro Jul 28, 2020
097b3a9
pr feedback
sanzmauro Jul 29, 2020
47efc31
wip
sanzmauro Jul 29, 2020
73f1aaf
pr feedback
sanzmauro Jul 29, 2020
3bf6b3f
updated erros to warn
sanzmauro Jul 29, 2020
892d01c
Merge pull request #140 from splitio/polishing-v2
sanzmauro Aug 3, 2020
46d38d9
wip
sanzmauro Jul 30, 2020
409ddd7
sse implementation
sanzmauro Jul 30, 2020
26134ba
improvements
sanzmauro Jul 30, 2020
e45dc18
wip
sanzmauro Jul 31, 2020
c968fb1
changes in sse structure
mredolatti Jul 31, 2020
9640815
sse working
sanzmauro Jul 31, 2020
51777c6
backoff implementation. fixed tests
sanzmauro Aug 3, 2020
9df0aa9
error message handler
sanzmauro Aug 3, 2020
06f9d44
added notifiactionManagerKeeper register
sanzmauro Aug 3, 2020
eab944c
fixed event source stop first time
sanzmauro Aug 3, 2020
5c4c476
undo expiration
sanzmauro Aug 3, 2020
be422be
polishing
sanzmauro Aug 3, 2020
92e54cf
undo expiration
sanzmauro Aug 3, 2020
76542f0
update pom to shade jersey
mredolatti Jul 30, 2020
896010f
fixed backoff
sanzmauro Aug 4, 2020
bafafe3
pr feedback
sanzmauro Aug 4, 2020
1266d6c
pr feedback
sanzmauro Aug 4, 2020
ca4fe69
added sinchronizer UT
sanzmauro Aug 5, 2020
7e5a733
fixed test
sanzmauro Aug 5, 2020
5b0c28e
logs improvements
sanzmauro Aug 5, 2020
bbff655
builds
mredolatti Aug 9, 2020
4b0719d
tests passing
mredolatti Aug 11, 2020
b57e24f
Merge pull request #142 from splitio/sse_changes
sanzmauro Aug 11, 2020
c8c9633
Merge pull request #141 from splitio/fix/shadeJersey
mredolatti Aug 11, 2020
9f870f6
catch disconnected status
mredolatti Aug 12, 2020
d23d701
removed comments and added debug logs
sanzmauro Aug 12, 2020
2837176
builds
mredolatti Aug 9, 2020
6d1e33e
tests passing
mredolatti Aug 11, 2020
395fdfd
catch disconnected status
mredolatti Aug 12, 2020
459008e
removed comments and added debug logs
sanzmauro Aug 12, 2020
80ab288
added missing break and or condition
sanzmauro Aug 12, 2020
8a19881
undo hardcode expiration
sanzmauro Aug 12, 2020
71c5ade
fix some tests
mredolatti Aug 13, 2020
75f351e
added setUp initialization
sanzmauro Aug 13, 2020
4859564
syncManager.shutdown async
sanzmauro Aug 13, 2020
254f31e
added integration tests and mocks servers
sanzmauro Aug 6, 2020
b532e77
added tests
sanzmauro Aug 10, 2020
f12d050
added tests
sanzmauro Aug 11, 2020
b2312bd
added keep alive tests
sanzmauro Aug 12, 2020
888bc6e
debug tests
sanzmauro Aug 12, 2020
f00da3f
added UTs
sanzmauro Aug 13, 2020
158e6d9
fixed test
sanzmauro Aug 13, 2020
d467892
debug
sanzmauro Aug 13, 2020
035b180
Merge pull request #143 from splitio/sse_suggestions
mredolatti Aug 13, 2020
acf918d
Merge pull request #144 from splitio/integration-tests-sse-mock-server
sanzmauro Aug 13, 2020
f527421
use awaitility on integration tests
mredolatti Aug 13, 2020
dfb5c54
debug test
sanzmauro Aug 14, 2020
e87832f
debugging tests
sanzmauro Aug 14, 2020
6753e60
debugging tests
sanzmauro Aug 14, 2020
a7c7853
debugging tests
sanzmauro Aug 14, 2020
7e493a7
updated _featuresRefreshRate default to 60 seconds
sanzmauro Aug 17, 2020
7d7a53d
updated sdk version
sanzmauro Aug 19, 2020
37492cc
updated changes.txt
sanzmauro Aug 19, 2020
90609b3
ignored tests
sanzmauro Aug 19, 2020
4961107
Merge branch 'development' into streaming-support
sanzmauro Aug 19, 2020
848dc84
Merge pull request #145 from splitio/streaming-support
sanzmauro Aug 19, 2020
1a9fd45
updated version
sanzmauro Aug 19, 2020
4dafc39
Merge pull request #147 from splitio/release-3.3.5
sanzmauro Aug 19, 2020
a54ea7b
updated version
sanzmauro Aug 19, 2020
3c492b3
Merge pull request #148 from splitio/release-4.0.0
sanzmauro Aug 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions client/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
CHANGES

4.0.0 (Aug 19, 2020)
- Added support for the new Split streaming architecture. When enabled (default), the SDK will not poll for updates but instead receive notifications every time there's a change in your environments, allowing to process those much quicker. If disabled or in the event of an issue, the SDK will fallback to the known polling mechanism to provide a seamless experience.
- Updated the default of featuresRefreshRate to 60 seconds.

3.3.4 (Jul 15, 2020)
- Added Impression observer.

3.3.3 (Apr 7, 2020)
- Fix issue regarding special characters come from split/segments fetchers.

Expand Down
72 changes: 66 additions & 6 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.split.client</groupId>
<artifactId>java-client-parent</artifactId>
<version>3.3.4</version>
<version>4.0.0</version>
</parent>
<artifactId>java-client</artifactId>
<packaging>jar</packaging>
Expand All @@ -19,15 +19,15 @@
<version>3.3</version>
<inherited>false</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<!-- Shade dependencies to avoid conflicts with other customer's libs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -47,9 +47,18 @@
<include>org.apache.httpcomponents:httpcore</include>
<include>com.google.code.gson:gson</include>
<include>com.google.guava:guava</include>
<include>org.yaml.snakeyaml</include>
<include>org.yaml.snakeyaml.*</include>
<include>org.glassfish.*</include>
<include>jakarta.*</include>
<include>org.javassist:javassist</include>
<include>com.sun.activation:jakarta.activation</include>
<include>org.jvnet.*</include>
</includes>
</artifactSet>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<relocations>
<relocation>
<pattern>org.apache.http</pattern>
Expand All @@ -59,6 +68,26 @@
<pattern>com.google</pattern>
<shadedPattern>split.com.google</shadedPattern>
</relocation>
<relocation>
<pattern>org.glassfish</pattern>
<shadedPattern>split.org.glassfish</shadedPattern>
</relocation>
<relocation>
<pattern>jakarta</pattern>
<shadedPattern>split.jakarta</shadedPattern>
</relocation>
<relocation>
<pattern>org.javassist</pattern>
<shadedPattern>split.org.javassist</shadedPattern>
</relocation>
<relocation>
<pattern>com.sun.activation</pattern>
<shadedPattern>split.com.sun.activation</shadedPattern>
</relocation>
<relocation>
<pattern>org.jvnet</pattern>
<shadedPattern>split.org.jvnet</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
Expand All @@ -67,7 +96,9 @@
<exclude>META-INF/license/**</exclude>
<exclude>META-INF/*</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>META-INF/services/**</exclude>
<!-- Disabled to allow Jersey implementation mappings/injector to work
<exclude>META-INF/services/**</exclude>
-->
<exclude>LICENSE</exclude>
<exclude>NOTICE</exclude>
<exclude>/*.txt</exclude>
Expand Down Expand Up @@ -139,6 +170,17 @@
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-sse</artifactId>
<version>2.31</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.31</version>
</dependency>

<!-- Test deps -->
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -169,5 +211,23 @@
<version>1.7.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>2.26</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
119 changes: 113 additions & 6 deletions client/src/main/java/io/split/client/SplitClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public class SplitClientConfig {
private final boolean _destroyOnShutDown;
private final String _splitFile;
private final IntegrationsConfig _integrationsConfig;
private final boolean _streamingEnabled;
private final int _authRetryBackoffBase;
private final int _streamingReconnectBackoffBase;
private final String _authServiceURL;
private final String _streamingServiceURL;

// Proxy configs
private final HttpHost _proxy;
Expand Down Expand Up @@ -76,7 +81,12 @@ private SplitClientConfig(String endpoint,
int maxStringLength,
boolean destroyOnShutDown,
String splitFile,
IntegrationsConfig integrationsConfig) {
IntegrationsConfig integrationsConfig,
boolean streamingEnabled,
int authRetryBackoffBase,
int streamingReconnectBackoffBase,
String authServiceURL,
String streamingServiceURL) {
_endpoint = endpoint;
_eventsEndpoint = eventsEndpoint;
_featuresRefreshRate = pollForFeatureChangesEveryNSeconds;
Expand All @@ -101,6 +111,11 @@ private SplitClientConfig(String endpoint,
_destroyOnShutDown = destroyOnShutDown;
_splitFile = splitFile;
_integrationsConfig = integrationsConfig;
_streamingEnabled = streamingEnabled;
_authRetryBackoffBase = authRetryBackoffBase;
_streamingReconnectBackoffBase = streamingReconnectBackoffBase;
_authServiceURL = authServiceURL;
_streamingServiceURL = streamingServiceURL;

Properties props = new Properties();
try {
Expand Down Expand Up @@ -207,13 +222,33 @@ public IntegrationsConfig integrationsConfig() {
return _integrationsConfig;
}

public boolean streamingEnabled() {
return _streamingEnabled;
}

public int authRetryBackoffBase() {
return _authRetryBackoffBase;
}

public int streamingReconnectBackoffBase() {
return _streamingReconnectBackoffBase;
}

public String authServiceURL() {
return _authServiceURL;
}

public String streamingServiceURL() {
return _streamingServiceURL;
}

public static final class Builder {

private String _endpoint = "https://sdk.split.io";
private boolean _endpointSet = false;
private String _eventsEndpoint = "https://events.split.io";
private boolean _eventsEndpointSet = false;
private int _featuresRefreshRate = 5;
private int _featuresRefreshRate = 60;
private int _segmentsRefreshRate = 60;
private int _impressionsRefreshRate = 30;
private int _impressionsQueueSize = 30000;
Expand All @@ -236,6 +271,11 @@ public static final class Builder {
private boolean _destroyOnShutDown = true;
private String _splitFile = null;
private IntegrationsConfig _integrationsConfig = null;
private boolean _streamingEnabled = true;
private int _authRetryBackoffBase = 1;
private int _streamingReconnectBackoffBase = 1;
private String _authServiceURL = "https://auth.split.io/api/auth";
private String _streamingServiceURL = "https://streaming.split.io/event-stream";

public Builder() {
}
Expand Down Expand Up @@ -572,6 +612,55 @@ public Builder integrations(IntegrationsConfig config) {
return this;
}

/**
* Set if streaming is enabled or not. Default is true.
* @param streamingEnabled
* @return
*/
public Builder streamingEnabled(boolean streamingEnabled) {
_streamingEnabled = streamingEnabled;
return this;
}

/**
* Set how many seconds to wait before re attempting to authenticate for push notifications. Default 1 second. Minimum 1 second.
* @param authRetryBackoffBase
* @return
*/
public Builder authRetryBackoffBase(int authRetryBackoffBase) {
_authRetryBackoffBase = authRetryBackoffBase;
return this;
}

/**
* Set how many seconds to wait before re attempting to connect to streaming. Default 1 second. Minimum 1 second.
* @param streamingReconnectBackoffBase
* @return
*/
public Builder streamingReconnectBackoffBase(int streamingReconnectBackoffBase) {
_streamingReconnectBackoffBase = streamingReconnectBackoffBase;
return this;
}

/**
* Set Authentication service URL.
* @param authServiceURL
* @return
*/
public Builder authServiceURL(String authServiceURL) {
_authServiceURL = authServiceURL;
return this;
}

/**
* Set Streaming service URL.
* @param streamingServiceURL
* @return
*/
public Builder streamingServiceURL(String streamingServiceURL) {
_streamingServiceURL = streamingServiceURL;
return this;
}

public SplitClientConfig build() {
if (_featuresRefreshRate < 5 ) {
Expand Down Expand Up @@ -622,6 +711,22 @@ public SplitClientConfig build() {
throw new IllegalArgumentException("Number of threads for fetching segments MUST be greater than zero");
}

if (_authRetryBackoffBase <= 0) {
throw new IllegalArgumentException("authRetryBackoffBase: must be >= 1");
}

if (_streamingReconnectBackoffBase <= 0) {
throw new IllegalArgumentException("streamingReconnectBackoffBase: must be >= 1");
}

if (_authServiceURL == null) {
throw new IllegalArgumentException("authServiceURL must not be null");
}

if (_streamingServiceURL == null) {
throw new IllegalArgumentException("streamingServiceURL must not be null");
}

return new SplitClientConfig(
_endpoint,
_eventsEndpoint,
Expand All @@ -646,10 +751,12 @@ public SplitClientConfig build() {
_maxStringLength,
_destroyOnShutDown,
_splitFile,
_integrationsConfig);
_integrationsConfig,
_streamingEnabled,
_authRetryBackoffBase,
_streamingReconnectBackoffBase,
_authServiceURL,
_streamingServiceURL);
}

}


}
8 changes: 8 additions & 0 deletions client/src/main/java/io/split/client/SplitFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import io.split.client.metrics.FireAndForgetMetrics;
import io.split.client.metrics.HttpMetrics;
import io.split.engine.SDKReadinessGates;
import io.split.engine.common.SyncManager;
import io.split.engine.common.SyncManagerImp;
import io.split.engine.experiments.RefreshableSplitFetcherProvider;
import io.split.engine.experiments.SplitChangeFetcher;
import io.split.engine.experiments.SplitParser;
Expand Down Expand Up @@ -209,6 +211,10 @@ public SplitFactoryImpl(String apiToken, SplitClientConfig config) throws URISyn

final EventClient eventClient = EventClientImpl.create(httpclient, eventsRootTarget, config.eventsQueueSize(), config.eventFlushIntervalInMillis(), config.waitBeforeShutdown());

// SyncManager
final SyncManager syncManager = SyncManagerImp.build(config.streamingEnabled(), splitFetcherProvider, segmentFetcher, config.authServiceURL(), httpclient, config.streamingServiceURL(), config.authRetryBackoffBase());
syncManager.start();

destroyer = new Runnable() {
public void run() {
_log.info("Shutdown called for split");
Expand All @@ -227,6 +233,8 @@ public void run() {
_log.info("Successful shutdown of httpclient");
eventClient.close();
_log.info("Successful shutdown of httpclient");
new Thread(syncManager::shutdown).start();
_log.info("Successful shutdown of syncManager");
} catch (IOException e) {
_log.error("We could not shutdown split", e);
}
Expand Down
27 changes: 27 additions & 0 deletions client/src/main/java/io/split/engine/common/Backoff.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.split.engine.common;

import java.util.concurrent.atomic.AtomicInteger;

import static com.google.common.base.Preconditions.checkNotNull;

public class Backoff {
private static final long BACKOFF_MAX_SECONDS_ALLOWED = 1800;

private final long _backoffBase;
private AtomicInteger _attempt;

public Backoff(long backoffBase) {
_backoffBase = checkNotNull(backoffBase);
_attempt = new AtomicInteger(0);
}

public long interval() {
long interval = _backoffBase * (long) Math.pow(2, _attempt.getAndIncrement());

return interval >= BACKOFF_MAX_SECONDS_ALLOWED ? BACKOFF_MAX_SECONDS_ALLOWED : interval;
}

public synchronized void reset() {
_attempt.set(0);
}
}
16 changes: 16 additions & 0 deletions client/src/main/java/io/split/engine/common/PushManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.split.engine.common;

public interface PushManager {

enum Status {
STREAMING_READY,
STREAMING_BACKOFF,
STREAMING_DOWN,
STREAMING_OFF
}

void start();
void stop();
void startWorkers();
void stopWorkers();
}
Loading