use of org.eclipse.flux.core.ServiceDiscoveryConnector in project flux by eclipse.
the class JDTComponent method activate.
@Activate
public void activate(final ComponentContext context) throws Exception {
final boolean lazyStart = org.eclipse.flux.core.Activator.getDefault().isLazyStart();
final ChannelSwitcher channelSwitcher = org.eclipse.flux.core.Activator.getDefault().getChannelSwitcher();
final MessageConnector messagingConnector = org.eclipse.flux.core.Activator.getDefault().getMessageConnector();
if (messagingConnector != null) {
new Thread() {
@Override
public void run() {
String userChannel = channelSwitcher.getChannel();
JdtChannelListener jdtChannelListener = new JdtChannelListener();
for (; userChannel == null; userChannel = channelSwitcher.getChannel()) {
try {
sleep(WAIT_TIME_PERIOD);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
discoveryConnector = new ServiceDiscoveryConnector(channelSwitcher, messagingConnector, JDT_SERVICE_ID, lazyStart);
if (lazyStart) {
keepAliveConnector = new KeepAliveConnector(channelSwitcher, messagingConnector, JDT_SERVICE_ID);
}
jdtChannelListener.connected(userChannel);
messagingConnector.addChannelListener(jdtChannelListener);
}
}.start();
}
}
Aggregations