commit
3ebe358ddb
10 files changed
+31
-21
No files matched your search
+1
-1
@@ -32,4 +32,4 @@ tags
|
|||||||
**/yarn.lock
|
**/yarn.lock
|
||||||
**/*.blg
|
**/*.blg
|
||||||
**/*.log
|
**/*.log
|
||||||
**/.*.out
|
**/*.out
|
||||||
@@ -22,12 +22,12 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<spring.version>5.0.5.RELEASE</spring.version>
|
<spring.version>5.0.7.RELEASE</spring.version>
|
||||||
<spring.security.version>5.0.4.RELEASE</spring.security.version>
|
<spring.security.version>5.0.6.RELEASE</spring.security.version>
|
||||||
<main.basedir>${project.basedir}</main.basedir>
|
<main.basedir>${project.basedir}</main.basedir>
|
||||||
<hibernate.version>5.2.16.Final</hibernate.version>
|
<hibernate.version>5.2.16.Final</hibernate.version>
|
||||||
<flyway.version>5.0.7</flyway.version>
|
<flyway.version>5.1.4</flyway.version>
|
||||||
<leak-prevention.version>2.6.0</leak-prevention.version>
|
<leak-prevention.version>2.6.1</leak-prevention.version>
|
||||||
<current.version>1.0.0-RELEASE</current.version>
|
<current.version>1.0.0-RELEASE</current.version>
|
||||||
<slf4j.version>1.7.25</slf4j.version>
|
<slf4j.version>1.7.25</slf4j.version>
|
||||||
<findbugs.version>3.0.5</findbugs.version>
|
<findbugs.version>3.0.5</findbugs.version>
|
||||||
@@ -295,7 +295,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.data</groupId>
|
<groupId>org.springframework.data</groupId>
|
||||||
<artifactId>spring-data-jpa</artifactId>
|
<artifactId>spring-data-jpa</artifactId>
|
||||||
<version>2.0.6.RELEASE</version>
|
<version>2.0.8.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -57,12 +57,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-dbcp2</artifactId>
|
<artifactId>commons-dbcp2</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.6.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Apache http client -->
|
<!-- Apache http client -->
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class PortalDataSource {
|
|||||||
pcf.setValidationQuery("SELECT 1");
|
pcf.setValidationQuery("SELECT 1");
|
||||||
pcf.setDefaultAutoCommit(true);
|
pcf.setDefaultAutoCommit(true);
|
||||||
|
|
||||||
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
|
GenericObjectPoolConfig<PoolableConnection> poolConfig = new GenericObjectPoolConfig<>();
|
||||||
poolConfig.setMinIdle(10);
|
poolConfig.setMinIdle(10);
|
||||||
poolConfig.setMaxTotal(100);
|
poolConfig.setMaxTotal(100);
|
||||||
|
|
||||||
|
|||||||
@@ -91,13 +91,6 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.protobuf</groupId>
|
|
||||||
<artifactId>protobuf-java</artifactId>
|
|
||||||
<version>3.5.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<main.basedir>${project.parent.basedir}</main.basedir>
|
<main.basedir>${project.parent.basedir}</main.basedir>
|
||||||
<database.driver>com.mysql.jdbc.Driver</database.driver>
|
<database.driver>com.mysql.cj.jdbc.Driver</database.driver>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|||||||
+14
@@ -49,6 +49,20 @@ public class MigrationItem {
|
|||||||
public int qtyPending() {
|
public int qtyPending() {
|
||||||
return pendingMigrations.length;
|
return pendingMigrations.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void repair() {
|
||||||
|
//Perform a repair just in case an upgrade before 5.0 happens
|
||||||
|
try {
|
||||||
|
//TODO find a better way to perform repair if previous version was before 5.0
|
||||||
|
String schemas = Arrays.toString(getSchemas()).replace("[", "").replace("]", "");
|
||||||
|
logger.info(String.format("Repair status for %s:%n%s", schemas, getAllMigrationsLog()));
|
||||||
|
flyway.repair();
|
||||||
|
} catch (Exception e) {
|
||||||
|
String message = String.format("%nDatabase repair error:%n %s %nPortal webapp cannot continue.", e.getMessage());
|
||||||
|
logger.error(message);
|
||||||
|
throw new RuntimeException(message, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the migration
|
* Perform the migration
|
||||||
|
|||||||
+4
-1
@@ -40,7 +40,10 @@ public class MigrationManager {
|
|||||||
|
|
||||||
DataSource ds = portalDatasource.getPortalRootDataSource();
|
DataSource ds = portalDatasource.getPortalRootDataSource();
|
||||||
migrations = Utils.toList( new MigrationItem(PortalMigration.getFlyway(ds)) );
|
migrations = Utils.toList( new MigrationItem(PortalMigration.getFlyway(ds)) );
|
||||||
migrations.forEach(item -> item.migrate());
|
migrations.forEach(item -> {
|
||||||
|
item.repair();
|
||||||
|
item.migrate();
|
||||||
|
});
|
||||||
portalDatasource.closeRootDataSource();
|
portalDatasource.closeRootDataSource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jgit</groupId>
|
<groupId>org.eclipse.jgit</groupId>
|
||||||
<artifactId>org.eclipse.jgit</artifactId>
|
<artifactId>org.eclipse.jgit</artifactId>
|
||||||
<version>4.11.0.201803080745-r</version>
|
<version>5.0.1.201806211838-r</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ package net.locusworks.portal.websocket;
|
|||||||
|
|
||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
import org.springframework.messaging.MessageChannel;
|
import org.springframework.messaging.MessageChannel;
|
||||||
import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
import org.springframework.messaging.support.ChannelInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class to handle websocket outbound connections
|
* class to handle websocket outbound connections
|
||||||
@@ -11,7 +11,7 @@ import org.springframework.messaging.support.ChannelInterceptorAdapter;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WebsocketOutboundChannelInterceptor extends ChannelInterceptorAdapter {
|
public class WebsocketOutboundChannelInterceptor implements ChannelInterceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||||
|
|||||||
Reference in new issue
Block a user