Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-51551] Allow CommandTransport and its sub-classes to be sub-…
…typed from outside (#272)

* Change some CommandTransport methods from package-private to protected

* Change read() and write() access to public

* Make fields public to implement remoting-kafka-agent
  • Loading branch information
pvtuan10 authored and oleg-nenashev committed Jun 7, 2018
1 parent cc7778e commit bed0a07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/main/java/hudson/remoting/CommandTransport.java
Expand Up @@ -49,17 +49,15 @@
* @since 2.13
*/
public abstract class CommandTransport {
/**
* Package private so as not to allow direct subtyping (just yet.)
*/
/*package*/ CommandTransport() {

protected CommandTransport() {
}

/**
* SPI implemented by {@link Channel} so that the transport can pass the received command
* to {@link Channel} for processing.
*/
static interface CommandReceiver {
protected static interface CommandReceiver {
/**
* Notifies the channel that a new {@link Command} was received from the other side.
*
Expand Down Expand Up @@ -142,7 +140,7 @@ static interface CommandReceiver {
* Informational flag that indicates that this is the last
* call of the {@link #write(Command, boolean)}.
*/
abstract void write(Command cmd, boolean last) throws IOException;
public abstract void write(Command cmd, boolean last) throws IOException;

/**
* Called to close the write side of the transport, allowing the underlying transport
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hudson/remoting/JarCache.java
Expand Up @@ -24,7 +24,7 @@ public abstract class JarCache {
/**
* Default JAR cache location for disabled workspace Manager.
*/
/*package*/ static final File DEFAULT_NOWS_JAR_CACHE_LOCATION =
public static final File DEFAULT_NOWS_JAR_CACHE_LOCATION =
new File(System.getProperty("user.home"),".jenkins/cache/jars");

//TODO: replace by checked exception
Expand Down
Expand Up @@ -31,7 +31,7 @@ public abstract class SynchronousCommandTransport extends CommandTransport {
/**
* Called by {@link Channel} to read the next command to arrive from the stream.
*/
abstract Command read() throws IOException, ClassNotFoundException, InterruptedException;
public abstract Command read() throws IOException, ClassNotFoundException, InterruptedException;

@Override
public void setup(Channel channel, CommandReceiver receiver) {
Expand Down

0 comments on commit bed0a07

Please sign in to comment.