JavaDoc and performance
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -26,10 +26,25 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
public interface DistributionSet extends NamedVersionedEntity {
|
||||
|
||||
/**
|
||||
* @return {@link Set} of assigned {@link DistributionSetTag}s.
|
||||
* @return immutable {@link Set} of assigned {@link DistributionSetTag}s.
|
||||
*/
|
||||
Set<DistributionSetTag> getTags();
|
||||
|
||||
/**
|
||||
* @param tag
|
||||
* to add
|
||||
* @return <code>true</code> if tag could be added sucessfully (i.e. was not
|
||||
* already in the list).
|
||||
*/
|
||||
boolean addTag(final DistributionSetTag tag);
|
||||
|
||||
/**
|
||||
* @param tag
|
||||
* to remove
|
||||
* @return <code>true</code> if tag was in the list and removed
|
||||
*/
|
||||
boolean removeTag(final DistributionSetTag tag);
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if the set is deleted and only kept for history
|
||||
* purposes.
|
||||
|
||||
@@ -158,6 +158,7 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
return Collections.unmodifiableSet(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addTag(final DistributionSetTag tag) {
|
||||
if (tags == null) {
|
||||
tags = new HashSet<>();
|
||||
@@ -166,6 +167,7 @@ public class JpaDistributionSet extends AbstractJpaNamedVersionedEntity implemen
|
||||
return tags.add(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeTag(final DistributionSetTag tag) {
|
||||
if (tags == null) {
|
||||
return false;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
private static final int BLOCK_SIZE = 10_000;
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final BlockingDeque<org.eclipse.hawkbit.eventbus.event.Event> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
private final BlockingDeque<Event> queue = new LinkedBlockingDeque<>(BLOCK_SIZE);
|
||||
private final EventBus.SessionEventBus eventBus;
|
||||
private final com.google.common.eventbus.EventBus systemEventBus;
|
||||
private int uiid = -1;
|
||||
@@ -173,26 +173,20 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.debug("UI EventBus aggregator started for UI {}", uiid);
|
||||
LOG.debug("UI EventBus aggregator started for UI {}", vaadinUI.getUIId());
|
||||
final long timestamp = System.currentTimeMillis();
|
||||
|
||||
final int size = queue.size();
|
||||
if (size <= 0) {
|
||||
LOG.debug("UI EventBus aggregator for UI {} has nothing to do.", uiid);
|
||||
LOG.debug("UI EventBus aggregator for UI {} has nothing to do.", vaadinUI.getUIId());
|
||||
return;
|
||||
}
|
||||
|
||||
final List<Event> events = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final Event pollEvent = queue.poll();
|
||||
if (pollEvent == null) {
|
||||
continue;
|
||||
}
|
||||
events.add(pollEvent);
|
||||
}
|
||||
final int eventsSize = queue.drainTo(events);
|
||||
|
||||
if (events.isEmpty()) {
|
||||
LOG.debug("UI EventBus aggregator for UI {} has nothing to do.", uiid);
|
||||
LOG.debug("UI EventBus aggregator for UI {} has nothing to do.", vaadinUI.getUIId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,15 +195,13 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
return;
|
||||
}
|
||||
|
||||
final int eventsSize = events.size();
|
||||
|
||||
LOG.debug("UI EventBus aggregator dispatches {} events for session {} for UI {}", eventsSize, vaadinSession,
|
||||
uiid);
|
||||
vaadinUI.getUIId());
|
||||
|
||||
doDispatch(events, wrappedSession);
|
||||
|
||||
LOG.debug("UI EventBus aggregator done with sending {} events in {} ms for UI {}", eventsSize,
|
||||
System.currentTimeMillis() - timestamp, uiid);
|
||||
System.currentTimeMillis() - timestamp, vaadinUI.getUIId());
|
||||
|
||||
}
|
||||
|
||||
@@ -230,7 +222,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
LOG.debug("UI EventBus aggregator of UI {} left lock on session.", vaadinUI.getUIId());
|
||||
}).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
LOG.error("Wait for Vaadin session for UI {} interrupted!", uiid, e);
|
||||
LOG.error("Wait for Vaadin session for UI {} interrupted!", vaadinUI.getUIId(), e);
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
@@ -240,7 +232,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
|
||||
final Set<Class<?>> filterBulkEvenTypes = eventProvider.getFilteredBulkEventsType(events);
|
||||
|
||||
for (final Class<?> bulkType : filterBulkEvenTypes) {
|
||||
final List<org.eclipse.hawkbit.eventbus.event.Event> listBulkEvents = events.stream()
|
||||
final List<Event> listBulkEvents = events.stream()
|
||||
.filter(event -> DelayedEventBusPushStrategy.eventSecurityCheck(userContext, event)
|
||||
&& bulkType.isInstance(event))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Reference in New Issue
Block a user