Skip to content

Commit

Permalink
- Removed synchronization on RouterStub.writeRequest(), not needed: h…
Browse files Browse the repository at this point in the history
…ttps://issues.redhat.com/browse/JGRP-2746

- RouterStubManager uses CopyOnWriteList for stubs to prevent over-synchronization
- Separate tests ServerTest (Byteman) and ServerTests (which don't require byteman)
- Removed Reader/connected in NioConnection
  • Loading branch information
belaban committed Jan 23, 2024
1 parent 30928a7 commit 0f67c50
Show file tree
Hide file tree
Showing 12 changed files with 444 additions and 447 deletions.
1 change: 0 additions & 1 deletion conf/tcp-nio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<!--RSVP resend_interval="2000" timeout="10000"/-->
<pbcast.STATE_TRANSFER/>
</config>
15 changes: 8 additions & 7 deletions src/org/jgroups/blocks/cs/NioBaseServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class NioBaseServer extends BaseServer {
protected volatile boolean registration; // set to true after a registration; the acceptor sets it back to false

@ManagedAttribute(description="Max number of send buffers. Changing this value affects new buffers only",writable=true)
protected int max_send_buffers=5; // size of WriteBuffers send buffer array
protected int max_send_buffers=12; // size of send buffer array, will be doubled

@ManagedAttribute(description="Number of times select() was called")
protected int num_selects;
Expand Down Expand Up @@ -129,7 +129,6 @@ public void run() {
while(it.hasNext()) {
SelectionKey key=it.next();
NioConnection conn=(NioConnection)key.attachment();
it.remove();
try {
if(!key.isValid())
continue;
Expand All @@ -139,21 +138,23 @@ public void run() {
// https://issues.redhat.com/browse/JGRP-2727
if((ch.isConnectionPending() && ch.finishConnect()) || ch.isConnected()) {
conn.clearSelectionKey(SelectionKey.OP_CONNECT);
conn.connected(true);
}
}
else if(key.isAcceptable())
handleAccept(key);
else {
if (key.isReadable())
conn.receive();
if (key.isWritable())
if(key.isReadable())
conn.read();
if(key.isWritable())
conn.send();
}
}
catch(Throwable ex) {
closeConnection(conn);
}
finally {
it.remove();
}
}
}
acceptorDone();
Expand All @@ -165,7 +166,7 @@ protected boolean doSelect() {
int num=selector.select();
num_selects++;
checkforPendingRegistrations();
if(num == 0) return true;
return num >= 0;
}
catch(ClosedSelectorException closed_ex) {
log.trace("selector was closed; acceptor terminating");
Expand Down
Loading

0 comments on commit 0f67c50

Please sign in to comment.