public RPCHandler(int port) { supervisor = new Supervisor(new Transport()); this.port = port; }
@Override public void init() { if (slobroks != null) { orb = new Supervisor(new Transport()); mirror = new Mirror(orb, slobroks); } if (configSources != null) { if (mirror == null) { orb = new Supervisor(new Transport()); subscriber = subscribe(slobrokConfigId, new ConfigSourceSet(configSources)); } } }
/** * Constructs a new instance of this policy. The argument given is the connection spec to the slobrok to use for * resolving recipients, as well as the pattern to use when querying. This constructor does _not_ wait for the * mirror to become ready. * * @param arg The slobrok connection spec. */ public ExternPolicy(String arg) { if (arg == null || arg.length() == 0) { error = "Expected parameter, got empty string."; return; } String[] args = arg.split(";", 2); if (args.length != 2 || args[0].length() == 0 || args[1].length() == 0) { error = "Expected parameter on the form '<spec>;<pattern>', got '" + arg + "'."; return; } int pos = args[1].lastIndexOf('/'); if (pos < 0) { error = "Expected pattern on the form '<service>/<session>', got '" + args[1] + "'."; return; } SlobrokList slobroks = new SlobrokList(); slobroks.setup(args[0].split(",")); pattern = args[1]; session = pattern.substring(pos); orb = new Supervisor(new Transport()); mirror = new Mirror(orb, slobroks); error = null; }
public static void main(String[] args) { //String fileReference = args[0]; String fileReference = "59f93f445438c9db7ccbf1629f583c2aa004a68b"; String filename = "com.yahoo.vespatest.ExtraHitSearcher-1.0.0-deploy.jar"; File file = new File(String.format("/tmp/%s/%s", fileReference, filename)); byte[] blob = null; try { blob = IOUtils.readFileBytes(file); } catch (IOException e) { e.printStackTrace(); } log.log(LogLevel.INFO, "Read blob from " + file.getAbsolutePath()); Supervisor supervisor = new Supervisor(new Transport()); Spec spec = new Spec("tcp/localhost:19090"); log.log(LogLevel.INFO, "Connecting to " + spec); Target target = supervisor.connect(spec); if (! target.isValid()) { log.log(LogLevel.INFO, "Could not connect"); System.exit(1); } else { log.log(LogLevel.INFO, "Connected to " + spec); } new RpcTester(target).call(fileReference, filename, blob); }
public Slobrok(int port) throws ListenFailedException { orb = new Supervisor(new Transport()); registerMethods(); try { listener = orb.listen(new Spec(port)); } catch (ListenFailedException e) { orb.transport().shutdown().join(); throw e; } }
/** * The container has no rpc methods, but we still need an RPC sever * to register in Slobrok to enable orchestration */ private Register registerInSlobrok(SlobroksConfig slobrokConfig, QrConfig qrConfig) { if ( ! qrConfig.rpc().enabled()) return null; // 1. Set up RPC server supervisor = new Supervisor(new Transport()); Spec listenSpec = new Spec(qrConfig.rpc().port()); try { acceptor = supervisor.listen(listenSpec); } catch (ListenFailedException e) { throw new RuntimeException("Could not create rpc server listening on " + listenSpec, e); } // 2. Register it in slobrok SlobrokList slobrokList = new SlobrokList(); slobrokList.setup(slobrokConfig.slobrok().stream().map(SlobroksConfig.Slobrok::connectionspec).toArray(String[]::new)); Spec mySpec = new Spec(HostName.getLocalhost(), acceptor.port()); slobrokRegistrator = new Register(supervisor, slobrokList, mySpec); slobrokRegistrator.registerName(qrConfig.rpc().slobrokId()); log.log(LogLevel.INFO, "Registered name '" + qrConfig.rpc().slobrokId() + "' at " + mySpec + " with: " + slobrokList); return slobrokRegistrator; }
connectspec="tcp/" + connectspec; supervisor=new Supervisor(new Transport()); target = supervisor.connect(new Spec(connectspec)); Request request=createRequest(method,arguments);
this.slobroksConfig = slobrokConfig; identity = params.getIdentity(); orb = new Supervisor(new Transport()); orb.setMaxInputBufferSize(params.getMaxInputBufferSize()); orb.setMaxOutputBufferSize(params.getMaxOutputBufferSize());