Skip to content

Commit

Permalink
[AF-893] Upgrade Social Framework to use new cluster infra
Browse files Browse the repository at this point in the history
[AF-894] Delete old cluster infrastructure
  • Loading branch information
ederign authored and porcelli committed Nov 9, 2017
1 parent 1c10f62 commit f8e4602
Show file tree
Hide file tree
Showing 46 changed files with 621 additions and 3,493 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<version.org.easytesting.fest>${version.org.easytesting.fest}</version.org.easytesting.fest>
<version.org.hamcrest>${version.org.hamcrest}</version.org.hamcrest>

<version.org.apache.helix>${version.org.apache.helix}</version.org.apache.helix>
<version.org.eclipse.jgit>${version.org.eclipse.jgit}</version.org.eclipse.jgit>
<version.com.jcraft>${version.com.jcraft}</version.com.jcraft>

Expand Down Expand Up @@ -144,18 +143,6 @@
<version>\${version.com.jcraft}</version>
</dependency>

<dependency>
<groupId>org.apache.helix</groupId>
<artifactId>helix-core</artifactId>
<version>\${version.org.apache.helix}</version>
<exclusions>
<exclusion>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Formatting -->
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
Expand All @@ -49,16 +48,13 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uberfire.commons.cluster.ClusterServiceFactory;
import org.uberfire.commons.concurrent.Unmanaged;
import org.uberfire.commons.lifecycle.PriorityDisposableRegistry;
import org.uberfire.commons.services.cdi.Startable;
import org.uberfire.commons.services.cdi.Startup;
import org.uberfire.commons.services.cdi.StartupType;
import org.uberfire.commons.services.cdi.Veto;
import org.uberfire.io.IOService;
import org.uberfire.io.impl.IOServiceNio2WrapperImpl;
import org.uberfire.io.impl.cluster.IOServiceClusterImpl;
import org.uberfire.java.nio.IOException;
import org.uberfire.java.nio.base.FileSystemState;
import org.uberfire.java.nio.file.FileStore;
Expand Down Expand Up @@ -359,28 +355,7 @@ public boolean isNullable() {
@Override
public IOService create(CreationalContext<IOService> ctx) {

final Bean<ClusterServiceFactory> clusterFactoryBean = (Bean<ClusterServiceFactory>) bm.getBeans("clusterServiceFactory").iterator().next();
final CreationalContext<ClusterServiceFactory> _ctx = bm.createCreationalContext(clusterFactoryBean);
final ClusterServiceFactory clusterServiceFactory = (ClusterServiceFactory) bm.getReference(clusterFactoryBean,
ClusterServiceFactory.class,
_ctx);

final ExecutorService executorService = getBean(bm,
ExecutorService.class,
new AnnotationLiteral<Unmanaged>() {
});

final IOService result;

if (clusterServiceFactory == null) {
result = new IOServiceNio2WrapperImpl();
} else {
result = new IOServiceClusterImpl(new IOServiceNio2WrapperImpl(),
clusterServiceFactory,
executorService);
}

return result;
return new IOServiceNio2WrapperImpl();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.thoughtworks.xstream.XStream;
import org.jboss.errai.bus.server.annotations.Service;
import org.kie.soup.commons.xstream.XStreamUtils;
import org.uberfire.commons.cluster.ClusterServiceFactory;
import org.uberfire.commons.cluster.ClusterParameters;
import org.uberfire.io.IOService;
import org.uberfire.java.nio.IOException;
import org.uberfire.java.nio.file.FileVisitResult;
Expand All @@ -48,14 +48,13 @@ public class WorkbenchServicesImpl implements WorkbenchServices {

public static final String PERSPECTIVE_EXTENSION = ".perspective";
private final XStream xs = XStreamUtils.createTrustingXStream();
private final ClusterParameters clusterParameters = new ClusterParameters();

@Inject
@Named("configIO")
private IOService ioService;
@Inject
private UserServicesImpl userServices;
@Inject
@Named("clusterServiceFactory")
private ClusterServiceFactory clusterServiceFactory;

@Override
public void save(final String perspectiveId,
Expand Down Expand Up @@ -210,7 +209,7 @@ public void saveDefaultEditors(final Map<String, String> properties) {

@Override
public boolean isWorkbenchOnCluster() {
return clusterServiceFactory != null;
return clusterParameters.isAppFormerClustered();
}

private Path getPathToDefaultEditors() {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@

import org.jboss.errai.security.shared.service.AuthenticationService;
import org.uberfire.backend.server.security.IOSecurityAuth;
import org.uberfire.commons.cluster.ClusterServiceFactory;
import org.uberfire.commons.concurrent.Unmanaged;
import org.uberfire.commons.lifecycle.PriorityDisposableRegistry;
import org.uberfire.commons.services.cdi.Startup;
import org.uberfire.commons.services.cdi.StartupType;
import org.uberfire.io.IOService;
import org.uberfire.io.impl.IOServiceNio2WrapperImpl;
import org.uberfire.io.impl.cluster.IOServiceClusterImpl;
import org.uberfire.java.nio.file.FileSystem;

@ApplicationScoped
Expand All @@ -42,8 +40,6 @@ public class ConfigIOServiceProducer {

private static ConfigIOServiceProducer instance;

private ClusterServiceFactory clusterServiceFactory;

private ExecutorService executorService;

private Instance<AuthenticationService> applicationProvidedConfigIOAuthService;
Expand All @@ -62,25 +58,16 @@ public ConfigIOServiceProducer() {
}

@Inject
public ConfigIOServiceProducer(@Named("clusterServiceFactory") ClusterServiceFactory clusterServiceFactory,
@Unmanaged ExecutorService executorService,
public ConfigIOServiceProducer(@Unmanaged ExecutorService executorService,
@IOSecurityAuth Instance<AuthenticationService> applicationProvidedConfigIOAuthService) {
this.clusterServiceFactory = clusterServiceFactory;
this.executorService = executorService;
this.applicationProvidedConfigIOAuthService = applicationProvidedConfigIOAuthService;
}

@PostConstruct
public void setup() {
instance = this;
if (clusterServiceFactory == null) {
configIOService = new IOServiceNio2WrapperImpl("config");
} else {
configIOService = new IOServiceClusterImpl(new IOServiceNio2WrapperImpl("config"),
clusterServiceFactory,
clusterServiceFactory.isAutoStart(),
executorService);
}
configIOService = new IOServiceNio2WrapperImpl("config");
configFileSystem = (FileSystem) PriorityDisposableRegistry.get("systemFS");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.uberfire.commons.cluster.ClusterService;
import org.uberfire.commons.concurrent.Managed;
import org.uberfire.commons.concurrent.Unmanaged;
import org.uberfire.commons.lifecycle.Disposable;
Expand Down Expand Up @@ -55,19 +54,8 @@ public void contextInitialized(final ServletContextEvent sce) {

@Override
public void contextDestroyed(final ServletContextEvent sce) {
ClusterService clusterService = null;

final List<PriorityDisposable> disposables = new ArrayList<PriorityDisposable>(PriorityDisposableRegistry.getDisposables());
for (final PriorityDisposable disposable : disposables) {
if (disposable instanceof ClusterService) {
clusterService = (ClusterService) disposable;
}
}

if (clusterService != null) {
disposables.remove(clusterService);
clusterService.lock();
}

sort(disposables);

Expand All @@ -84,11 +72,6 @@ public void contextDestroyed(final ServletContextEvent sce) {
}
}

if (clusterService != null) {
clusterService.unlock();
clusterService.dispose();
}

PriorityDisposableRegistry.clear();
}

Expand Down
Loading

0 comments on commit f8e4602

Please sign in to comment.