@Override public void writeListBegin(TList list) throws TException { if (list.elemType == TType.STRUCT || list.elemType == TType.MAP || list.elemType == TType.LIST || list.elemType == TType.SET) { throw new TException("Not implemented: nested structures"); } firstInnerField = true; inner = true; }
@Override public ByteBuffer readBinary() throws TException { throw new TException("Not implemented for control separated data"); } }
@Override public String getStormRawConf() throws TException { try { return FileUtils.readFileToString(new File(LoadConf.getStormYamlPath())); } catch (IOException ex) { throw new TException(ex); } }
@Override public void open(String sessionId, String className) throws TException { logger.info(String.format("Open Interpreter %s for session %s ", className, sessionId)); Interpreter intp = getInterpreter(sessionId, className); try { intp.open(); } catch (InterpreterException e) { throw new TException("Fail to open interpreter", e); } }
@Override public void removeHostOutBlackList(String host) throws TException { StormClusterState stormClusterState = data.getStormClusterState(); try { stormClusterState.remove_from_blacklist(host); } catch (Exception e) { LOG.error("Failed to remove host out of black list", e); throw new TException(e); } }
@Override public void setHostInBlackList(String host) throws TException { StormClusterState stormClusterState = data.getStormClusterState(); try { stormClusterState.set_in_blacklist(host); } catch (Exception e) { LOG.error("Failed to set host in black list", e); throw new TException(e); } }
@Override public String getNimbusConf() throws TException { try { return JStormUtils.to_json(data.getConf()); } catch (Exception e) { String err = "Failed to get nimbus configuration"; LOG.error(err, e); throw new TException(err); } }
@Override public void beginLibUpload(String libName) throws TException { try { String parent = PathUtils.parent_path(libName); PathUtils.local_mkdirs(parent); data.getUploaders().put(libName, Channels.newChannel(new FileOutputStream(libName))); LOG.info("Begin upload file from client to " + libName); } catch (Exception e) { LOG.error("Fail to upload jar " + libName, e); throw new TException(e); } }
@Override public int updateBlobReplication(String key, int replication) throws TException { try { return data.getBlobStore().updateBlobReplication(key, replication); } catch (IOException e) { throw new TException(e); } }
@Override public int getBlobReplication(String key) throws TException { try { return data.getBlobStore().getBlobReplication(key); } catch (Exception e) { throw new TException(e); } }
@Override public Map<String, Long> registerMetrics(String topologyId, Set<String> metrics) throws TException { try { return ClusterMetricsRunnable.getInstance().getContext().registerMetrics(topologyId, metrics); } catch (Exception ex) { LOG.error("registerMetrics error", ex); throw new TException(ex); } }
@Override public StormTopology getUserTopology(String id) throws TException { try { StormTopology stormtopology = StormConfig.read_nimbus_topology_code(id, data.getBlobStore()); if (stormtopology == null) { throw new NotAliveException("No topology of " + id); } return stormtopology; } catch (Exception e) { LOG.error("Failed to get topology " + id + ",", e); throw new TException("Failed to get system_topology"); } }
@Override public String getFormType(String sessionId, String className) throws TException { Interpreter intp = getInterpreter(sessionId, className); try { return intp.getFormType().toString(); } catch (InterpreterException e) { throw new TException(e); } }
@Override public CurrentNotificationEventId get_current_notificationEventId() throws TException { try { authorizeProxyPrivilege(); } catch (Exception ex) { LOG.error("Not authorized to make the get_current_notificationEventId call. You can try to disable " + ConfVars.EVENT_DB_NOTIFICATION_API_AUTH.toString(), ex); throw new TException(ex); } RawStore ms = getMS(); return ms.getCurrentNotificationEventId(); }
@Override public TGetQueryIdResp GetQueryId(TGetQueryIdReq req) throws TException { try { return new TGetQueryIdResp(cliService.getQueryId(req.getOperationHandle())); } catch (HiveSQLException e) { throw new TException(e); } }
@Override public List<InterpreterCompletion> completion(String sessionId, String className, String buf, int cursor, RemoteInterpreterContext remoteInterpreterContext) throws TException { Interpreter intp = getInterpreter(sessionId, className); try { return intp.completion(buf, cursor, convert(remoteInterpreterContext, null)); } catch (InterpreterException e) { throw new TException("Fail to get completion", e); } }
@Override public void createStateInZookeeper(String key) throws TException { BlobStore blobStore = data.getBlobStore(); NimbusInfo nimbusInfo = data.getNimbusHostPortInfo(); if (blobStore instanceof LocalFsBlobStore) { int versionForKey = BlobStoreUtils.getVersionForKey(key, nimbusInfo, data.getConf()); try { data.getStormClusterState().setup_blobstore(key, nimbusInfo, versionForKey); } catch (Exception e) { throw new TException("create state in zookeeper error", e); } } LOG.debug("Created state in zookeeper for key:{} for nimbus:{}", key, nimbusInfo); }
@Override public void deleteBlob(String key) throws TException { BlobStore blobStore = data.getBlobStore(); blobStore.deleteBlob(key); if (blobStore instanceof LocalFsBlobStore) { try { data.getStormClusterState().remove_blobstore_key(key); data.getStormClusterState().remove_key_version(key); } catch (Exception e) { throw new TException(e); } } LOG.info("Deleted blob for key {}", key); }
@Test public void testHeartbeatContinuesTException() throws Exception { Throwable t = new TException(); doThrow(t).when(mockMetaStoreClient).heartbeat(0, LOCK_ID); HeartbeatTimerTask task = new HeartbeatTimerTask(mockMetaStoreClient, mockListener, TRANSACTION_ID, SOURCES, LOCK_ID); task.run(); verifyZeroInteractions(mockListener); }
private ThriftHBaseServiceHandler createHandler() throws TException { try { Configuration conf = UTIL.getConfiguration(); return new ThriftHBaseServiceHandler(conf, UserProvider.instantiate(conf)); } catch (IOException ie) { throw new TException(ie); } }