Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optionally skip node creation #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/org/jitsi/videobridge/pubsub/PubSubPublisher.java
Expand Up @@ -216,9 +216,13 @@ public void run()
* @param nodeName the name of the node.
* @throws Exception if sending the request fails.
*/
public void createNode(String nodeName)
public void createNode(String nodeName, boolean skip)
throws Exception
{
if (skip) {
nodes.add(nodeName);
return;
}
PubSub request = new PubSub();
request.setTo(serviceName);
request.setType(Type.SET);
Expand Down
10 changes: 8 additions & 2 deletions src/org/jitsi/videobridge/stats/PubSubStatsTransport.java
Expand Up @@ -40,6 +40,11 @@ public class PubSubStatsTransport
*/
private PubSubPublisher publisher;

/**
* Whether to skip node creation and configuration
*/
private boolean skipCreate;

/**
* The <tt>ServiceListener</tt> which listens to the <tt>BundleContext</tt>
* in which this <tt>StatsTransport</tt> is started in order to track when
Expand All @@ -66,10 +71,11 @@ public void serviceChanged(ServiceEvent ev)
* @param serviceName the name of the service.
* @param nodeName the name of the PubSub node.
*/
public PubSubStatsTransport(String serviceName, String nodeName)
public PubSubStatsTransport(String serviceName, String nodeName, boolean skipCreate)
{
this.serviceName = serviceName;
this.nodeName = nodeName;
this.skipCreate = skipCreate;
}

/**
Expand Down Expand Up @@ -120,7 +126,7 @@ private void init()
publisher.addResponseListener(this);
try
{
publisher.createNode(nodeName);
publisher.createNode(nodeName, skipCreate);
}
catch (Exception e)
{
Expand Down
16 changes: 15 additions & 1 deletion src/org/jitsi/videobridge/stats/StatsManagerBundleActivator.java
Expand Up @@ -42,6 +42,11 @@ public class StatsManagerBundleActivator
*/
private static final String DEFAULT_STAT_TRANSPORT = null;

/**
* The default value for skipping the pubsub node creation and configuration
*/
private static final boolean DEFAULT_PUBSUB_SKIPNODECREATE = false;

/**
* The name of the property which enables generating and sending statistics
* about the Videobridge.
Expand Down Expand Up @@ -72,6 +77,13 @@ public class StatsManagerBundleActivator
private static final String PUBSUB_SERVICE_PNAME
= "org.jitsi.videobridge.PUBSUB_SERVICE";

/**
* The name of the property which specifies whether to skip node creation
* and configuration when the PubSub transport is used to send statistics.
*/
private static final String PUBSUB_SKIP_NODECREATE
= "org.jitsi.videobridge.PUBSUB_SKIP_NODE_CREATION";

/**
* The value for COLIBRI statistics transport.
*/
Expand Down Expand Up @@ -175,11 +187,13 @@ private void start(ConfigurationService cfg)
// Add StatsTransports to StatsManager.
String transport = DEFAULT_STAT_TRANSPORT;
int interval = DEFAULT_STAT_INTERVAL;
boolean skipNodeCreate = DEFAULT_PUBSUB_SKIPNODECREATE;

if (cfg != null)
{
transport = cfg.getString(STATISTICS_TRANSPORT_PNAME, transport);
interval = cfg.getInt(STATISTICS_INTERVAL_PNAME, interval);
skipNodeCreate = cfg.getBoolean(PUBSUB_SKIP_NODECREATE, skipNodeCreate);
}
if (STAT_TRANSPORT_COLIBRI.equals(transport))
{
Expand All @@ -193,7 +207,7 @@ else if (STAT_TRANSPORT_PUBSUB.equals(transport))
if(service != null && node != null)
{
statsMgr.addTransport(
new PubSubStatsTransport(service, node),
new PubSubStatsTransport(service, node, skipNodeCreate),
interval);
}
else
Expand Down