Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JGRP-2807 Allow setting bundler instance #807

Closed
Closed
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
16 changes: 10 additions & 6 deletions src/org/jgroups/protocols/TP.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,16 @@ public <T extends TP> T setLocalTransport(String tp_class) throws Exception {

public Bundler getBundler() {return bundler;}

/** Installs a bundler. Needs to be done before the channel is connected */
/** Installs a bundler */
public <T extends TP> T setBundler(Bundler bundler) {
if(bundler != null)
this.bundler=bundler;
if(this.bundler != null)
this.bundler.stop();
bundler.init(this);
bundler.start();
this.bundler=bundler;
return (T)this;
}


public ThreadPool getThreadPool() {
return thread_pool;
}
Expand Down Expand Up @@ -771,8 +773,10 @@ public String toString() {
msg_factory=clazz.getDeclaredConstructor().newInstance();
}

bundler=createBundler(bundler_type, getClass());
bundler.init(this);
if (bundler == null) {
bundler=createBundler(bundler_type, getClass());
bundler.init(this);
}
}


Expand Down
1 change: 0 additions & 1 deletion tests/junit-functional/org/jgroups/protocols/RED_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ protected JChannel create(String name) throws Exception {
transport.getProtocolStack().removeProtocol(UNICAST3.class);
retval.getProtocolStack().insertProtocolInStack(red, transport, ProtocolStack.Position.ABOVE);
bundler=new DelayBundler();
bundler.init(transport);
transport.setBundler(bundler);
((GMS)retval.getProtocolStack().findProtocol(GMS.class)).setJoinTimeout(5);
return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class HeadersResizeTest {

public void testResizing() throws Exception {
BatchingBundler bundler=new BatchingBundler();
TP transport=a.getProtocolStack().getTransport();
bundler.init(transport);
a.getProtocolStack().getTransport().setBundler(bundler);

MyReceiver receiver=new MyReceiver();
Expand Down