Skip to content

Commit

Permalink
upgrade parent version, add some java8 sugar syntax
Browse files Browse the repository at this point in the history
Signed-off-by: olivier lamy <olamy@apache.org>
  • Loading branch information
olamy committed Sep 22, 2018
1 parent 1eb2a6e commit 8eb5b04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.6</version>
<version>3.17</version>
</parent>

<artifactId>pubsub-light</artifactId>
Expand All @@ -18,6 +18,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.level>8</java.level>
<jenkins.version>2.121.1</jenkins.version>
</properties>

<scm>
Expand Down Expand Up @@ -45,7 +46,6 @@
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>

Expand Down
14 changes: 4 additions & 10 deletions src/main/java/org/jenkinsci/plugins/pubsub/GuavaPubsubBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ public GuavaPubsubBus() {
@Override
protected ChannelPublisher publisher(@Nonnull String channelName) {
final EventBus channelBus = getChannelBus(channelName);
return new ChannelPublisher() {
public void publish(@Nonnull Message message) {
channelBus.post(message);
}
};
return message -> channelBus.post(message);
}

@Override
Expand Down Expand Up @@ -130,14 +126,12 @@ public void onMessage(@Nonnull final Message message) {
if (message instanceof AccessControlledMessage) {
if (authentication != null) {
final AccessControlledMessage accMessage = (AccessControlledMessage) message;
ACL.impersonate(authentication, new Runnable() {
@Override
public void run() {
ACL.impersonate(authentication,
() -> {
if (accMessage.hasPermission(accMessage.getRequiredPermission())) {
subscriber.onMessage(message.clone());
}
}
});
});
}
} else {
subscriber.onMessage(message.clone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public class SyncQueueListener extends QueueListener {
private static final long POLL_TIMEOUT_MILLIS = 1000;

static {
new Thread() {
@Override
public void run() {
new Thread(()->{
try {
// Keep going 'til we're signaled to stop.
while (!stopTaskLeftPublishing) {
Expand Down Expand Up @@ -126,8 +124,7 @@ public void run() {
queueTaskLeftPublishQueue.clear();
tryLaterQueueTaskLeftQueue.clear();
}
}
}.start();
}).start();
}

public static void shutdown() {
Expand Down

0 comments on commit 8eb5b04

Please sign in to comment.