Skip to content

Commit

Permalink
Throw UnsupportedOperationException for unsupported ForkChannel.conne…
Browse files Browse the repository at this point in the history
…ct() methods
  • Loading branch information
cfredri4 authored Apr 5, 2024
1 parent 0f138c9 commit a4e7757
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/org/jgroups/fork/ForkChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,23 @@ public ForkChannel connect(String cluster_name) throws Exception {
return this;
}

@Override
public ForkChannel connect(String cluster_name, boolean useFlushIfPresent) throws Exception {
throw new UnsupportedOperationException();
}

@Override
public ForkChannel connect(String cluster_name, Address target, long timeout) throws Exception {
connect(cluster_name);
main_channel.getState(target, timeout);
return this;
}

@Override
public ForkChannel connect(String cluster_name, Address target, long timeout, boolean useFlushIfPresent) throws Exception {
throw new UnsupportedOperationException();
}

/** Removes the fork-channel from the fork-stack's hashmap and resets its state. Does <em>not</em> affect the
* main-channel */
@Override
Expand All @@ -189,8 +199,7 @@ public ForkChannel disconnect() {
return this;
}

/** Closes the fork-channel, essentially setting its state to CLOSED. Note that - contrary to a regular channel -
* a closed fork-channel can be connected again: this means re-attaching the fork-channel to the main-channel*/
/** Closes the fork-channel, essentially setting its state to CLOSED */
@Override
public void close() {
((ForkProtocolStack)prot_stack).remove(fork_channel_id);
Expand Down Expand Up @@ -263,7 +272,6 @@ protected ForkChannel setLocalAddress(Address local_addr) {
return this;
}


/**
* Creates a new FORK protocol, or returns the existing one, or throws an exception. Never returns null.
*/
Expand All @@ -281,8 +289,6 @@ protected static FORK getFORK(JChannel ch, ProtocolStack.Position position, Clas
return fork;
}



protected void setHeader(Message msg) {
FORK.ForkHeader hdr=msg.getHeader(FORK.ID);
if(hdr != null)
Expand All @@ -291,7 +297,6 @@ protected void setHeader(Message msg) {
msg.putHeader(FORK.ID, new FORK.ForkHeader(null, fork_channel_id));
}


/** Copies state from main-channel to this fork-channel */
protected void copyFields() {
for(Field field: copied_fields) {
Expand Down

0 comments on commit a4e7757

Please sign in to comment.