Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -775,16 +775,6 @@ These are bugs, correctness issues, or missing functionality that may affect pro

---

### 71. Tribes UDP Keepalive (1 item)

| # | File:Line | Description | Fix Idea | Effort | Difficulty |
|---|-----------|-------------|----------|--------|------------|
| 71.1 | `AbstractSender.java:121` | UDP connections always disconnected; keepalive not optimized | Implement UDP keepalive by tracking last activity time and only disconnecting after idle timeout. | 1-2 days | Medium |

**Total estimated effort: 1-2 days, Medium difficulty**

---

### 72. Tribes NIO Optimization (2 items)

| # | File:Line | Description | Fix Idea | Effort | Difficulty |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ public AbstractSender() {
@Override
public boolean keepalive() {
boolean disconnect = false;
if (isUdpBased()) {
disconnect = true; // always disconnect UDP
} else if (keepAliveCount >= 0 && requestCount > keepAliveCount) {
if (keepAliveCount >= 0 && requestCount > keepAliveCount) {
disconnect = true;
} else if (keepAliveTime >= 0 && (System.currentTimeMillis() - connectTime) > keepAliveTime) {
disconnect = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.tribes.transport;

import org.junit.Assert;
import org.junit.Test;

import org.apache.catalina.tribes.transport.nio.NioSender;

public class TestAbstractSenderKeepAlive {

@Test
public void testUdpKeepAlive() {
AbstractSender sender = new NioSender();
sender.setUdpBased(true);

Assert.assertFalse(sender.keepalive());

sender.setKeepAliveCount(0);
sender.setRequestCount(1);
Assert.assertTrue(sender.keepalive());
}

@Test
public void testUdpKeepAliveTime() {
AbstractSender sender = new NioSender();
sender.setUdpBased(true);
sender.setKeepAliveTime(1000);
sender.setConnectTime(System.currentTimeMillis() - 2000);

Assert.assertTrue(sender.keepalive());
}
}
5 changes: 5 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,11 @@
</subsection>
<subsection name="Tribes">
<changelog>
<update>
Reuse UDP sender channels between messages and apply the configured
<code>keepAliveCount</code> and <code>keepAliveTime</code> limits rather
than closing the channel after every message. (sainadh777)
</update>
<!-- Entries for backport and removal before 12.0.0-M1 below this line -->
<fix>
When the <code>MessageDispatchInterceptor</code> is configured with
Expand Down