use of org.graylog2.plugin.streams.DefaultStream in project graylog2-server by Graylog2.
the class DefaultStreamProvider method get.
@Override
public Stream get() {
Stream defaultStream = sharedInstance.get();
if (defaultStream != null) {
return defaultStream;
}
synchronized (this) {
defaultStream = sharedInstance.get();
if (defaultStream != null) {
return defaultStream;
}
int i = 0;
do {
try {
LOG.debug("Loading shared default stream instance");
defaultStream = service.load(Stream.DEFAULT_STREAM_ID);
} catch (NotFoundException ignored) {
if (i % 10 == 0) {
LOG.warn("Unable to load default stream, tried {} times, retrying every 500ms. Processing is blocked until this succeeds.", i + 1);
}
i++;
Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
} while (defaultStream == null);
sharedInstance.set(defaultStream);
}
return defaultStream;
}
use of org.graylog2.plugin.streams.DefaultStream in project graylog2-server by Graylog2.
the class FunctionsSnippetsTest method removeFromStream.
@Test
public void removeFromStream() {
final Rule rule = parser.parseRule(ruleForTest(), true);
final Message message = evaluateRule(rule, msg -> msg.addStream(otherStream));
assertThat(message).isNotNull();
assertThat(message.getStreams()).containsOnly(defaultStream);
}
use of org.graylog2.plugin.streams.DefaultStream in project graylog2-server by Graylog2.
the class FunctionsSnippetsTest method removeFromStreamRetainDefault.
@Test
public void removeFromStreamRetainDefault() {
final Rule rule = parser.parseRule(ruleForTest(), true);
final Message message = evaluateRule(rule, msg -> msg.addStream(otherStream));
assertThat(message).isNotNull();
assertThat(message.getStreams()).containsOnly(defaultStream);
}
Aggregations