atlarge-research / opencraft

Other
5 stars 2 forks source link

Read-write broker/channel and unsafe channel - [merged] #167

Closed jdonkervliet closed 4 years ago

jdonkervliet commented 4 years ago

In GitLab by @swabbur on Jun 3, 2020, 13:43

Merges feature/read-write-broker -> development

Resolves issues #74, #75, and #98.

Add a read-write broker and channel and an unsafe channel that can be combined with each other and existing broker/channel implementations.

jdonkervliet commented 4 years ago

In GitLab by @julian9499 on Jun 3, 2020, 15:26

Commented on src/main/java/net/glowstone/messaging/channels/ReadWriteChannel.java line 37

I see a lot of repititve code with the locking. Is it not possible to extract this?

jdonkervliet commented 4 years ago

In GitLab by @JimVliet on Jun 3, 2020, 15:26

Commented on src/test/java/net/glowstone/messaging/brokers/JmsBrokerTest.java line 48

Perhaps, put the suppress warnings at this single line, instead of the entire method.

jdonkervliet commented 4 years ago

In GitLab by @swabbur on Jun 3, 2020, 15:30

Commented on src/main/java/net/glowstone/messaging/channels/ReadWriteChannel.java line 37

The only option would be to extract it to a separate method and to pass the content of the try-block as a lambda.

void locked(Lock lock, Runnable runnable) {
    lock.lock();
    try {
        runnable.run();
    } finally {
        lock.unlock();
    }
}

void publish() {
    locked(readLock, () -> {
        // ...
    });
}
jdonkervliet commented 4 years ago

In GitLab by @julian9499 on Jun 3, 2020, 15:30

Commented on src/main/java/net/glowstone/messaging/channels/ReadWriteChannel.java line 37

I would leave it like this for now

jdonkervliet commented 4 years ago

In GitLab by @swabbur on Jun 3, 2020, 15:32

added 1 commit

Compare with previous version

jdonkervliet commented 4 years ago

In GitLab by @JimVliet on Jun 3, 2020, 15:49

resolved all threads

jdonkervliet commented 4 years ago

In GitLab by @JimVliet on Jun 3, 2020, 15:49

merged

jdonkervliet commented 4 years ago

In GitLab by @JimVliet on Jun 3, 2020, 15:49

mentioned in commit bfbc3ccfc3e1982e7bbfa5385291d1a5ad906800