Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
67 changes: 64 additions & 3 deletions api/src/main/java/org/apache/unomi/api/ClusterNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,34 @@

package org.apache.unomi.api;

import java.io.Serializable;

/**
* Information about a cluster node.
*/
public class ClusterNode implements Serializable {
public class ClusterNode extends Item {

private static final long serialVersionUID = 1281422346318230514L;

public static final String ITEM_TYPE = "clusterNode";

private double cpuLoad;
private double[] loadAverage;
private String publicHostAddress;
private String internalHostAddress;
private long uptime;
private boolean master;
private boolean data;
private long startTime;
private long lastHeartbeat;

// Server information
private ServerInfo serverInfo;

/**
* Instantiates a new Cluster node.
*/
public ClusterNode() {
super();
setItemType(ITEM_TYPE);
}

/**
Expand Down Expand Up @@ -165,4 +172,58 @@ public boolean isData() {
public void setData(boolean data) {
this.data = data;
}

/**
* Retrieves the node start time in milliseconds.
*
* @return the start time
*/
public long getStartTime() {
return startTime;
}

/**
* Sets the node start time in milliseconds.
*
* @param startTime the start time
*/
public void setStartTime(long startTime) {
this.startTime = startTime;
}

/**
* Retrieves the last heartbeat time in milliseconds.
*
* @return the last heartbeat time
*/
public long getLastHeartbeat() {
return lastHeartbeat;
}

/**
* Sets the last heartbeat time in milliseconds.
*
* @param lastHeartbeat the last heartbeat time
*/
public void setLastHeartbeat(long lastHeartbeat) {
this.lastHeartbeat = lastHeartbeat;
}

/**
* Gets the server information.
*
* @return the server information
*/
public ServerInfo getServerInfo() {
return serverInfo;
}

/**
* Sets the server information.
*
* @param serverInfo the server information
*/
public void setServerInfo(ServerInfo serverInfo) {
this.serverInfo = serverInfo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.unomi.api.ClusterNode;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -51,11 +50,4 @@ public interface ClusterService {
*/
void purge(final String scope);

/**
* This function will send an event to the nodes of the cluster
* The function takes a Serializable to avoid dependency on any clustering framework
*
* @param event this object will be cast to a org.apache.karaf.cellar.core.event.Event object
*/
void sendEvent(Serializable event);
}
10 changes: 0 additions & 10 deletions extensions/router/router-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@
<version>${kafka.client.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<artifactId>org.apache.karaf.cellar.config</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.camel.component.jackson.JacksonDataFormat;
import org.apache.camel.core.osgi.OsgiDefaultCamelContext;
import org.apache.camel.model.RouteDefinition;
import org.apache.unomi.api.services.ClusterService;
import org.apache.unomi.api.services.ConfigSharingService;
import org.apache.unomi.api.services.ProfileService;
import org.apache.unomi.persistence.spi.PersistenceService;
Expand All @@ -31,7 +30,6 @@
import org.apache.unomi.router.api.RouterConstants;
import org.apache.unomi.router.api.services.ImportExportConfigurationService;
import org.apache.unomi.router.api.services.ProfileExportService;
import org.apache.unomi.router.core.event.UpdateCamelRouteEvent;
import org.apache.unomi.router.core.processor.ExportRouteCompletionProcessor;
import org.apache.unomi.router.core.processor.ImportConfigByFileNameProcessor;
import org.apache.unomi.router.core.processor.ImportRouteCompletionProcessor;
Expand Down Expand Up @@ -75,7 +73,6 @@ public class RouterCamelContext implements IRouterCamelContext {
private String allowedEndpoints;
private BundleContext bundleContext;
private ConfigSharingService configSharingService;
private ClusterService clusterService;

// TODO UNOMI-572: when fixing UNOMI-572 please remove the usage of the custom ScheduledExecutorService and re-introduce the Unomi Scheduler Service
private ScheduledExecutorService scheduler;
Expand All @@ -102,10 +99,6 @@ public void setConfigSharingService(ConfigSharingService configSharingService) {
this.configSharingService = configSharingService;
}

public void setClusterService(ClusterService clusterService) {
this.clusterService = clusterService;
}

public void setTracing(boolean tracing) {
camelContext.setTracing(true);
}
Expand Down Expand Up @@ -240,12 +233,6 @@ public void killExistingRoute(String routeId, boolean fireEvent) throws Exceptio
camelContext.removeRouteDefinition(routeDefinition);
}
}

if (fireEvent) {
UpdateCamelRouteEvent event = new UpdateCamelRouteEvent(EVENT_ID_REMOVE);
event.setRouteId(routeId);
clusterService.sendEvent(event);
}
}

public void updateProfileImportReaderRoute(String configId, boolean fireEvent) throws Exception {
Expand All @@ -266,11 +253,6 @@ public void updateProfileImportReaderRoute(String configId, boolean fireEvent) t
builder.setJacksonDataFormat(jacksonDataFormat);
builder.setContext(camelContext);
camelContext.addRoutes(builder);

if (fireEvent) {
UpdateCamelRouteEvent event = new UpdateCamelRouteEvent(EVENT_ID_IMPORT);
clusterService.sendEvent(event);
}
}
}

Expand All @@ -291,11 +273,6 @@ public void updateProfileExportReaderRoute(String configId, boolean fireEvent) t
profileExportCollectRouteBuilder.setJacksonDataFormat(jacksonDataFormat);
profileExportCollectRouteBuilder.setContext(camelContext);
camelContext.addRoutes(profileExportCollectRouteBuilder);

if (fireEvent) {
UpdateCamelRouteEvent event = new UpdateCamelRouteEvent(EVENT_ID_EXPORT);
clusterService.sendEvent(event);
}
}
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,13 @@
<property name="persistenceService" ref="persistenceService"/>
<property name="profileExportService" ref="profileExportService"/>
<property name="profileService" ref="profileService"/>
<property name="clusterService" ref="clusterService" />
</bean>
<service id="camelContextOSGI" ref="camelContext" interface="org.apache.unomi.router.api.IRouterCamelContext"/>

<bean id="collectProfileBean" class="org.apache.unomi.router.core.bean.CollectProfileBean">
<property name="persistenceService" ref="persistenceService"/>
</bean>

<bean id="updateCamelRouteEventHandler" class="org.apache.unomi.router.core.event.UpdateCamelRouteEventHandler">
<property name="configurationAdmin" ref="osgiConfigurationAdmin"/>
<property name="clusterManager" ref="karafCellarClusterManager"/>
<property name="groupManager" ref="karafCellarGroupManager"/>
<property name="routerCamelContext" ref="camelContext"/>
</bean>
<service ref="updateCamelRouteEventHandler" interface="org.apache.karaf.cellar.core.event.EventHandler">
<service-properties>
<entry key="managed" value="true"/>
</service-properties>
</service>

<reference id="configSharingService" interface="org.apache.unomi.api.services.ConfigSharingService" />
<reference id="profileImportService" interface="org.apache.unomi.router.api.services.ProfileImportService"/>
<reference id="profileExportService" interface="org.apache.unomi.router.api.services.ProfileExportService"/>
Expand All @@ -141,8 +128,6 @@
<reference id="importConfigurationService" interface="org.apache.unomi.router.api.services.ImportExportConfigurationService" filter="(configDiscriminator=IMPORT)"/>
<reference id="exportConfigurationService" interface="org.apache.unomi.router.api.services.ImportExportConfigurationService" filter="(configDiscriminator=EXPORT)"/>
<reference id="clusterService" interface="org.apache.unomi.api.services.ClusterService" />
<reference id="karafCellarGroupManager" interface="org.apache.karaf.cellar.core.GroupManager" />
<reference id="osgiConfigurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
<reference id="karafCellarClusterManager" interface="org.apache.karaf.cellar.core.ClusterManager" />

</blueprint>
</blueprint>
Loading
Loading