-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Design with createComponent extension point (#8)
* Draft createComponent extension point Signed-off-by: Owais Kazi <[email protected]> * Resolved issue of transport stopped Signed-off-by: Owais Kazi <[email protected]> * Decoupled response handler to separate classes Signed-off-by: Owais Kazi <[email protected]> * Addressed PR Comments Signed-off-by: Owais Kazi <[email protected]> * Removed CountDown Latch Signed-off-by: Owais Kazi <[email protected]> * Refactoring and PR comments Signed-off-by: Owais Kazi <[email protected]> * Addressed PR Comments Signed-off-by: Owais Kazi <[email protected]> * Abstracted send request to APIs Signed-off-by: Owais Kazi <[email protected]> * Added comment for OpenSearchNode Signed-off-by: Owais Kazi <[email protected]>
- Loading branch information
1 parent
e38ac94
commit c825b83
Showing
6 changed files
with
198 additions
and
35 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/org/opensearch/sdk/ClusterSettingsResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.opensearch.sdk; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.cluster.ClusterSettingsResponse; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.threadpool.ThreadPool; | ||
import org.opensearch.transport.TransportException; | ||
import org.opensearch.transport.TransportResponseHandler; | ||
|
||
import java.io.IOException; | ||
|
||
public class ClusterSettingsResponseHandler implements TransportResponseHandler<ClusterSettingsResponse> { | ||
private static final Logger logger = LogManager.getLogger(ClusterSettingsResponseHandler.class); | ||
|
||
@Override | ||
public void handleResponse(ClusterSettingsResponse response) { | ||
logger.info("received {}", response); | ||
} | ||
|
||
@Override | ||
public void handleException(TransportException exp) { | ||
logger.info("ClusterSettingRequest failed", exp); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return ThreadPool.Names.GENERIC; | ||
} | ||
|
||
@Override | ||
public ClusterSettingsResponse read(StreamInput in) throws IOException { | ||
return new ClusterSettingsResponse(in); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/org/opensearch/sdk/ClusterStateResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.opensearch.sdk; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.action.admin.cluster.state.ClusterStateResponse; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.threadpool.ThreadPool; | ||
import org.opensearch.transport.TransportException; | ||
import org.opensearch.transport.TransportResponseHandler; | ||
|
||
import java.io.IOException; | ||
|
||
public class ClusterStateResponseHandler implements TransportResponseHandler<ClusterStateResponse> { | ||
private static final Logger logger = LogManager.getLogger(ClusterStateResponseHandler.class); | ||
|
||
@Override | ||
public void handleResponse(ClusterStateResponse response) { | ||
logger.info("received {}", response); | ||
} | ||
|
||
@Override | ||
public void handleException(TransportException exp) { | ||
logger.info("ExtensionClusterStateRequest failed", exp); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return ThreadPool.Names.GENERIC; | ||
} | ||
|
||
@Override | ||
public ClusterStateResponse read(StreamInput in) throws IOException { | ||
return new ClusterStateResponse(in); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/org/opensearch/sdk/LocalNodeResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.opensearch.sdk; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.cluster.LocalNodeResponse; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.threadpool.ThreadPool; | ||
import org.opensearch.transport.TransportException; | ||
import org.opensearch.transport.TransportResponseHandler; | ||
|
||
import java.io.IOException; | ||
|
||
public class LocalNodeResponseHandler implements TransportResponseHandler<LocalNodeResponse> { | ||
private static final Logger logger = LogManager.getLogger(LocalNodeResponseHandler.class); | ||
|
||
@Override | ||
public void handleResponse(LocalNodeResponse response) { | ||
logger.info("received {}", response); | ||
} | ||
|
||
@Override | ||
public void handleException(TransportException exp) { | ||
logger.info("LocalNodeRequest failed", exp); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return ThreadPool.Names.GENERIC; | ||
} | ||
|
||
@Override | ||
public LocalNodeResponse read(StreamInput in) throws IOException { | ||
return new LocalNodeResponse(in); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters