Merge remote-tracking branch 'origin/dev-1.1.0' into development

Conflicts:
	src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/AsyncBatchEventSaveStrategy.java
This commit is contained in:
anhefti 2021-03-04 15:23:27 +01:00
commit 84035da42f
6 changed files with 26 additions and 36 deletions

View file

@ -176,8 +176,7 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
final String requestURI = request.getRequestURI(); final String requestURI = request.getRequestURI();
if (requestURI.startsWith(this.remoteProctoringEndpoint)) { if (requestURI.startsWith(this.remoteProctoringEndpoint)) {
// TODO try to verify if this is only the remoteProctoringEndpoint or with addition
// if there is addition, try redirect otherwise forward as is
final RequestDispatcher dispatcher = request final RequestDispatcher dispatcher = request
.getServletContext() .getServletContext()
.getRequestDispatcher(this.remoteProctoringEndpoint); .getRequestDispatcher(this.remoteProctoringEndpoint);
@ -263,27 +262,4 @@ public final class InstitutionalAuthenticationEntryPoint implements Authenticati
return null; return null;
} }
/** TODO this seems not to work as expected. Different Theme is only possible in RAP on different
* entry-points and since entry-points are statically defined within the RAPConfiguration
* there is no possibility to apply them dynamically within an institution so far.
*
* @param institutionalEndpoint
* @return */
// private boolean initInstitutionalBasedThemeEntryPoint(final String institutionalEndpoint) {
// try {
// final ApplicationContextImpl appContext = (ApplicationContextImpl) RWT.getApplicationContext();
// final Map<String, String> properties = new HashMap<>();
// properties.put(WebClient.THEME_ID, "sms");
// appContext.getEntryPointManager().register(
// institutionalEndpoint,
// new RAPSpringEntryPointFactory(),
// properties);
//
// return true;
// } catch (final Exception e) {
// log.warn("Failed to dynamically set entry point for institution: {}", institutionalEndpoint, e);
// return false;
// }
// }
} }

View file

@ -300,7 +300,10 @@ public class MonitoringClientConnection implements TemplateComposer {
EVENT_LIST_TITLE_TOOLTIP_KEY); EVENT_LIST_TITLE_TOOLTIP_KEY);
// client event table for this connection // client event table for this connection
this.pageService.entityTableBuilder(restService.getRestCall(GetExtendedClientEventPage.class)) this.pageService
.entityTableBuilder(
"seb-client-" + connectionToken,
restService.getRestCall(GetExtendedClientEventPage.class))
.withEmptyMessage(EMPTY_LIST_TEXT_KEY) .withEmptyMessage(EMPTY_LIST_TEXT_KEY)
.withPaging(this.pageSize) .withPaging(this.pageSize)
.withRestCallAdapter(restCallBuilder -> restCallBuilder.withQueryParam( .withRestCallAdapter(restCallBuilder -> restCallBuilder.withQueryParam(

View file

@ -22,6 +22,8 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
public class TableNavigator { public class TableNavigator {
private final static int PAGE_NAV_SIZE = 9; private final static int PAGE_NAV_SIZE = 9;
private final static int NAV_BUTTON_WIDTH = 35;
private final static int NAV_BUTON_HEIGHT = 16;
private final Composite composite; private final Composite composite;
private final EntityTable<?> entityTable; private final EntityTable<?> entityTable;
@ -114,7 +116,11 @@ public class TableNavigator {
final boolean selectable, final boolean selectable,
final Composite parent) { final Composite parent) {
final GridData rowData = new GridData(22, 16); final GridData rowData = new GridData(NAV_BUTTON_WIDTH, NAV_BUTON_HEIGHT);
rowData.verticalAlignment = SWT.CENTER;
rowData.horizontalAlignment = SWT.CENTER;
rowData.verticalIndent = 0;
final Label pageLabel = new Label(parent, SWT.NONE); final Label pageLabel = new Label(parent, SWT.NONE);
pageLabel.setText(" " + page + " "); pageLabel.setText(" " + page + " ");
pageLabel.setLayoutData(rowData); pageLabel.setLayoutData(rowData);
@ -131,7 +137,7 @@ public class TableNavigator {
final int numberOfPages, final int numberOfPages,
final Composite parent) { final Composite parent) {
final GridData rowData = new GridData(22, 16); final GridData rowData = new GridData(NAV_BUTTON_WIDTH, NAV_BUTON_HEIGHT);
final Label forward = new Label(parent, SWT.NONE); final Label forward = new Label(parent, SWT.NONE);
forward.setText(">"); forward.setText(">");
forward.setData(RWT.CUSTOM_VARIANT, CustomVariant.LIST_NAVIGATION.key); forward.setData(RWT.CUSTOM_VARIANT, CustomVariant.LIST_NAVIGATION.key);
@ -160,7 +166,7 @@ public class TableNavigator {
final int pageNumber, final int pageNumber,
final Composite parent) { final Composite parent) {
final GridData rowData = new GridData(22, 16); final GridData rowData = new GridData(NAV_BUTTON_WIDTH, NAV_BUTON_HEIGHT);
final Label start = new Label(parent, SWT.NONE); final Label start = new Label(parent, SWT.NONE);
start.setText("<<"); start.setText("<<");
start.setLayoutData(rowData); start.setLayoutData(rowData);

View file

@ -59,6 +59,9 @@ public class AsyncBatchEventSaveStrategy implements EventHandlingStrategy {
private static final int NUMBER_OF_WORKER_THREADS = 4; private static final int NUMBER_OF_WORKER_THREADS = 4;
private static final int BATCH_SIZE = 100; private static final int BATCH_SIZE = 100;
private static final int MIN_SLEEP_TIME = 100;
private static final int SLEEP_TIME_EXPAND = 100;
private static final int MAX_SLEEP_TIME = 5000;
private final SqlSessionFactory sqlSessionFactory; private final SqlSessionFactory sqlSessionFactory;
private final Executor executor; private final Executor executor;
@ -142,7 +145,7 @@ public class AsyncBatchEventSaveStrategy implements EventHandlingStrategy {
final ClientEventRecordMapper clientEventMapper = sqlSessionTemplate.getMapper( final ClientEventRecordMapper clientEventMapper = sqlSessionTemplate.getMapper(
ClientEventRecordMapper.class); ClientEventRecordMapper.class);
long sleepTime = 100; long sleepTime = MIN_SLEEP_TIME;
try { try {
while (this.workersRunning) { while (this.workersRunning) {
@ -151,7 +154,7 @@ public class AsyncBatchEventSaveStrategy implements EventHandlingStrategy {
try { try {
if (!events.isEmpty()) { if (!events.isEmpty()) {
sleepTime = 100; sleepTime = MIN_SLEEP_TIME;
this.transactionTemplate this.transactionTemplate
.execute(status -> { .execute(status -> {
events.forEach(clientEventMapper::insert); events.forEach(clientEventMapper::insert);
@ -159,8 +162,8 @@ public class AsyncBatchEventSaveStrategy implements EventHandlingStrategy {
}); });
sqlSessionTemplate.flushStatements(); sqlSessionTemplate.flushStatements();
} else { } else if (sleepTime < MAX_SLEEP_TIME) {
sleepTime += 100; sleepTime += SLEEP_TIME_EXPAND;
} }
} catch (final Exception e) { } catch (final Exception e) {
log.error("unexpected Error while trying to batch store client-events: ", e); log.error("unexpected Error while trying to batch store client-events: ", e);
@ -176,7 +179,9 @@ public class AsyncBatchEventSaveStrategy implements EventHandlingStrategy {
try { try {
sqlSessionTemplate.destroy(); sqlSessionTemplate.destroy();
} catch (final Exception e) { } catch (final Exception e) {
log.error("Failed to dispose SqlSessionTemplate", e); log.error("Failed to close and destroy the SqlSessionTemplate for this thread: {}",
Thread.currentThread(),
e);
} }
log.debug("Worker Thread {} stopped", Thread.currentThread()); log.debug("Worker Thread {} stopped", Thread.currentThread());
} }

View file

@ -161,7 +161,7 @@ Composite.logo {
Composite.bgLogo { Composite.bgLogo {
background-color: #1F407A; background-color: #1F407A;
background-image: url(static/images/ethz_logo_white.png); background-image: url(static/images/sebserver-logo.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: left center; background-position: left center;
} }

View file

@ -123,7 +123,7 @@ Composite.logo {
Composite.bgLogo { Composite.bgLogo {
background-color: #1F407A; background-color: #1F407A;
background-image: url(static/images/ethz_logo_white.png); background-image: url(static/images/sebserver-logo.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: left center; background-position: left center;
} }