use of org.apache.thrift.transport.TTransportException in project airavata by apache.
the class TestSSLClient method invoke.
private void invoke() {
// TTransport transport;
try {
// TSSLTransportFactory.TSSLTransportParameters params =
// new TSSLTransportFactory.TSSLTransportParameters();
// String keystorePath = ServerSettings.getCredentialStoreThriftServerKeyStorePath();
// String keystorePWD = ServerSettings.getCredentialStoreThriftServerKeyStorePassword();
// params.setTrustStore(keystorePath, keystorePWD);
final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
final String serverHost = ServerSettings.getCredentialStoreServerHost();
TTransport transport = new TSocket(serverHost, serverPort);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
// transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params);
// TProtocol protocol = new TBinaryProtocol(transport);
CredentialStoreService.Client client = new CredentialStoreService.Client(protocol);
testSSHCredential(client);
testCertificateCredential(client);
transport.close();
} catch (TTransportException e) {
e.printStackTrace();
} catch (ApplicationSettingsException e) {
e.printStackTrace();
}
}
use of org.apache.thrift.transport.TTransportException in project airavata by apache.
the class CredentialStoreServer method start.
@Override
public void start() throws Exception {
try {
setStatus(ServerStatus.STARTING);
final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
final String serverHost = ServerSettings.getCredentialStoreServerHost();
CredentialStoreService.Processor processor = new CredentialStoreService.Processor(new CredentialStoreServerHandler());
TServerTransport serverTransport;
if (serverHost == null) {
serverTransport = new TServerSocket(serverPort);
} else {
InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
serverTransport = new TServerSocket(inetSocketAddress);
}
TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
options.minWorkerThreads = 30;
server = new TThreadPoolServer(options.processor(processor));
new Thread() {
public void run() {
server.serve();
setStatus(ServerStatus.STOPPED);
logger.info("Credential store Server Stopped.");
}
}.start();
new Thread() {
public void run() {
while (!server.isServing()) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
break;
}
}
if (server.isServing()) {
setStatus(ServerStatus.STARTED);
logger.info("Starting Credential store Server on Port " + serverPort);
logger.info("Listening to Credential store clients ....");
}
}
}.start();
} catch (TTransportException e) {
setStatus(ServerStatus.FAILED);
throw new Exception("Error while starting the credential store service", e);
}
}
use of org.apache.thrift.transport.TTransportException in project airavata by apache.
the class RegistryAPIServer method StartRegistryServer.
public void StartRegistryServer(RegistryService.Processor<RegistryServerHandler> orchestratorServerHandlerProcessor) throws Exception {
// creating experiment catalog db
logger.info("Initializing ExperimentCatalog DB");
ExperimentCatalogInitUtil.initializeDB();
// creating app catalog db
logger.info("Initializing AppCatalog DB");
AppCatalogInitUtil.initializeDB();
// creating workflow catalog db
logger.info("Initializing WorkflowCatalog DB");
WorkflowCatalogInitUtil.initializeDB();
// creating replica catalog db
logger.info("Initializing ReplicaCatalog DB");
ReplicaCatalogInitUtil.initializeDB();
final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_PORT, "8960"));
try {
final String serverHost = ServerSettings.getSetting(Constants.REGISTRY_SERVER_HOST, null);
TServerTransport serverTransport;
if (serverHost == null) {
serverTransport = new TServerSocket(serverPort);
} else {
InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
serverTransport = new TServerSocket(inetSocketAddress);
}
// thrift server start
TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
options.minWorkerThreads = Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_MIN_THREADS, "30"));
server = new TThreadPoolServer(options.processor(orchestratorServerHandlerProcessor));
new Thread() {
public void run() {
server.serve();
setStatus(ServerStatus.STARTING);
logger.info("Starting Registry Server ... ");
}
}.start();
new Thread() {
public void run() {
while (!server.isServing()) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
break;
}
}
if (server.isServing()) {
setStatus(ServerStatus.STARTED);
logger.info("Started Registry Server on Port " + serverPort + " ...");
// start db event handlers
if (!startDatabaseEventHandlers()) {
logger.error("Stopping Registry Server as DB event handlers failed to start!");
server.stop();
}
}
}
}.start();
} catch (TTransportException e) {
logger.error(e.getMessage());
setStatus(ServerStatus.FAILED);
logger.error("Failed to start Registry server on port " + serverPort + " ...");
}
}
use of org.apache.thrift.transport.TTransportException in project airavata by apache.
the class AuroraThriftClient method getJobList.
/**
* Gets the job list.
*
* @param ownerRole the owner role
* @return the job list
* @throws Exception the exception
*/
public GetJobsResponseBean getJobList(String ownerRole) throws Exception {
GetJobsResponseBean response = null;
// try till we get response or scheduler connection not found
while (response == null) {
try {
Response jobListResponse = this.readOnlySchedulerClient.getJobs(ownerRole);
response = (GetJobsResponseBean) AuroraThriftClientUtil.getResponseBean(jobListResponse, ResponseResultType.GET_JOBS);
} catch (Exception ex) {
if (ex instanceof TTransportException) {
// if re-connection success, retry command
if (this.reconnectWithAuroraScheduler()) {
continue;
}
}
logger.error(ex.getMessage(), ex);
throw ex;
}
}
return response;
}
use of org.apache.thrift.transport.TTransportException in project airavata by apache.
the class GfacServer method StartGfacServer.
public void StartGfacServer(GfacService.Processor<GfacServerHandler> gfacServerHandlerProcessor) throws Exception {
final int serverPort = Integer.parseInt(ServerSettings.getGFacServerPort());
try {
final String serverHost = ServerSettings.getGfacServerHost();
InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
TServerTransport serverTransport = new TServerSocket(inetSocketAddress);
server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(gfacServerHandlerProcessor));
new Thread() {
public void run() {
server.serve();
setStatus(ServerStatus.STARTING);
logger.info("Starting Gfac Server ...");
}
}.start();
new Thread() {
public void run() {
while (!server.isServing()) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
break;
}
}
if (server.isServing()) {
setStatus(IServer.ServerStatus.STARTED);
logger.info("Started Gfac Server on Port " + serverPort + " ...");
}
}
}.start();
} catch (TTransportException e) {
logger.error(e.getMessage());
setStatus(IServer.ServerStatus.FAILED);
logger.error("Failed to start Gfac server on port " + serverPort + " ...");
}
}
Aggregations