本文整理汇总了Java中org.apache.avro.AvroRemoteException类的典型用法代码示例。如果您正苦于以下问题:Java AvroRemoteException类的具体用法?Java AvroRemoteException怎么用?Java AvroRemoteException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AvroRemoteException类属于org.apache.avro包,在下文中一共展示了AvroRemoteException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: append
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public Void append( AvroFlumeOGEvent evt ) throws AvroRemoteException {
counterGroup.incrementAndGet("rpc.received");
Map<String, String> headers = new HashMap<String, String>();
// extract Flume OG event headers
headers.put(HOST, evt.getHost().toString());
headers.put(TIMESTAMP, evt.getTimestamp().toString());
headers.put(PRIORITY, evt.getPriority().toString());
headers.put(NANOS, evt.getNanos().toString());
for (Entry<CharSequence, ByteBuffer> entry : evt.getFields().entrySet()) {
headers.put(entry.getKey().toString(), entry.getValue().toString());
}
headers.put(OG_EVENT, "yes");
Event event = EventBuilder.withBody(evt.getBody().array(), headers);
try {
getChannelProcessor().processEvent(event);
counterGroup.incrementAndGet("rpc.events");
} catch (ChannelException ex) {
return null;
}
counterGroup.incrementAndGet("rpc.successful");
return null;
}
示例2: listFilesPlugin
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
/**
*
* @param pluginId
* @return
* @throws AvroRemoteException
*/
@Override
public List<br.unb.cic.bionimbuz.avro.gen.PluginFile> listFilesPlugin(String pluginId) throws AvroRemoteException {
final HashSet<br.unb.cic.bionimbuz.avro.gen.PluginFile> listFiles = new HashSet<>();
br.unb.cic.bionimbuz.avro.gen.PluginFile file;
for (final PluginFile fileInfo : this.storageService.getFilesPeer(pluginId)) {
file = new br.unb.cic.bionimbuz.avro.gen.PluginFile();
file.setId(fileInfo.getId());
file.setName(fileInfo.getName());
file.setPath(fileInfo.getName());
file.setPluginId(fileInfo.getPluginId());
file.setSize(fileInfo.getSize());
file.setHash(fileInfo.getHash());
listFiles.add(file);
}
final List<br.unb.cic.bionimbuz.avro.gen.PluginFile> listFile = new ArrayList<>(listFiles);
return listFile;
}
示例3: startWorkflow
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
/**
* Create the workflow and users infos on zookeeper
* @param workflow
* @return
* @throws AvroRemoteException
*/
@Override
public String startWorkflow(Workflow workflow) throws AvroRemoteException {
// generate pipeline register
this.schedService.registerPipeline(workflow);
// Create /users
this.userController.registerUserWorkflow(workflow);
ArrayList<br.unb.cic.bionimbuz.model.Instance> instList = new ArrayList<>();
for(br.unb.cic.bionimbuz.avro.gen.Instance iAvro : workflow.getIntancesWorkflow()){
br.unb.cic.bionimbuz.model.Instance i = new br.unb.cic.bionimbuz.model.Instance(iAvro);
instList.add(i);
}
//Compara as instancias para cada workflow
this.slaController.compareHardware(instList, workflow.getUserId(), workflow.getId());
return "Pipeline enviado para o escalonamento. Aguarde...";
}
示例4: getPeersNode
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
/**
* Método RPC que pega os peers do zoonimbus e retorna uma lista do tipo
* NodeInfo
*
* @return lista de NodeInfo PeerId, Address, Freesize;
* @throws AvroRemoteException
*/
@Override
public synchronized List<NodeInfo> getPeersNode() throws AvroRemoteException {
NodeInfo nodeaux;
this.nodes.clear();
for (final PluginInfo info : this.discoveryService.getPeers().values()) {
nodeaux = new NodeInfo();
if (info != null) {
final String address = info.getHost().getAddress();
nodeaux.setAddress(address);
nodeaux.setPeerId(info.getId());
nodeaux.setFreesize(info.getFsFreeSize());
this.nodes.put(address, nodeaux);
}
}
return new ArrayList<>(this.nodes.values());
}
示例5: getJobInfo
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public AvroJob getJobInfo(String jobId) throws AvroRemoteException {
JobSpec spec = null;
try {
spec = scheduler.getJobQueue().getJobRepository()
.getJobById(jobId);
} catch (JobRepositoryException e) {
LOG.log(Level.WARNING,
"Exception communicating with job repository for job: ["
+ jobId + "]: Message: " + e.getMessage());
throw new AvroRemoteException(new JobRepositoryException("Unable to get job: [" + jobId
+ "] from repository!"));
}
return AvroTypeFactory.getAvroJob(spec.getJob());
}
示例6: killJob
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public boolean killJob(String jobId) throws AvroRemoteException {
String resNodeId = scheduler.getBatchmgr().getExecutionNode(jobId);
if (resNodeId == null) {
LOG.log(Level.WARNING, "Attempt to kill job: [" + jobId
+ "]: cannot find execution node"
+ " (has the job already finished?)");
return false;
}
ResourceNode node = null;
try {
node = scheduler.getMonitor().getNodeById(resNodeId);
} catch (MonitorException e) {
throw new AvroRemoteException(e);
}
return scheduler.getBatchmgr().killJob(jobId, node);
}
示例7: getWorkflowsByEvent
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public List<AvroWorkflow> getWorkflowsByEvent(String eventName) throws AvroRemoteException {
List workflows = null;
try {
workflows = repo.getWorkflowsForEvent(eventName);
if (workflows != null)
return AvroTypeFactory.getAvroWorkflows(workflows);
else
return new ArrayList();
} catch (Exception e) {
e.printStackTrace();
throw new AvroRemoteException(
"Exception getting workflows for event: " + eventName
+ " from repository: Message: " + e.getMessage());
}
}
示例8: paginateWorkflowInstances
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public AvroWorkflowInstancePage paginateWorkflowInstances(int pageNum) throws AvroRemoteException {
WorkflowInstancePage page = null;
try {
page = engine.getInstanceRepository()
.getPagedWorkflows(pageNum);
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return AvroTypeFactory.getAvroWorkflowInstancePage(page);
} else
return AvroTypeFactory.getAvroWorkflowInstancePage(WorkflowInstancePage
.blankPage());
} catch (InstanceRepositoryException e) {
throw new AvroRemoteException(e);
}
}
示例9: paginateWorkflowInstancesOfStatus
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public AvroWorkflowInstancePage paginateWorkflowInstancesOfStatus(int pageNum, String status)
throws AvroRemoteException{
WorkflowInstancePage page = null;
try {
page = engine.getInstanceRepository()
.getPagedWorkflows(pageNum, status);
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return AvroTypeFactory.getAvroWorkflowInstancePage(page);
} else
return AvroTypeFactory.getAvroWorkflowInstancePage(WorkflowInstancePage
.blankPage());
} catch (InstanceRepositoryException e) {
throw new AvroRemoteException(e);
}
}
示例10: isAlive
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public boolean isAlive() {
boolean success;
try {
if(proxy != null)
success = proxy.isAlive();
else return false;
} catch (AvroRemoteException e) {
LOG.log(Level.WARNING, "AvroRemoteException when connecting to filemgr: ["
+ this.fileManagerUrl + "]");
success = false;
}
return success;
}
示例11: echo
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public EchoOut echo(EchoIn message) throws AvroRemoteException {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < message.getTimes(); ++i) {
sb.append(message.getContent());
}
return new EchoOut(sb.toString());
}
示例12: checkEcho
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
protected void checkEcho(Asker client, String contentReference, int times) throws AvroRemoteException {
EchoOut reply = client.echo(new EchoIn(contentReference, times));
collector.checkThat(reply, CoreMatchers.notNullValue());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < times; ++i) {
sb.append(contentReference);
}
collector.checkThat(reply.getReply().toString(), CoreMatchers.equalTo(sb.toString()));
}
示例13: checkRandom
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
protected void checkRandom(Asker client, int times) throws AvroRemoteException {
int ms = checkClientMethods.length;
try {
for (int i = 0; i < times; ++i) {
Method m = checkClientMethods[random.nextInt(ms)];
m.invoke(this, client);
}
} catch (IllegalAccessException | InvocationTargetException e) {
collector.addError(e);
}
}
示例14: append
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
if (failed) {
logger.debug("Event rejected");
return Status.FAILED;
}
logger.debug("LB: Received event from append(): {}",
new String(event.getBody().array(), Charset.forName("UTF8")));
appendCount++;
return Status.OK;
}
示例15: appendBatch
import org.apache.avro.AvroRemoteException; //导入依赖的package包/类
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
AvroRemoteException {
if (failed) {
logger.debug("Event batch rejected");
return Status.FAILED;
}
logger.debug("LB: Received {} events from appendBatch()",
events.size());
appendBatchCount++;
return Status.OK;
}