@Override public void close() { target.close(); }
/** * <p>This method is used for explicit reference counting targets to allow * reusing open connections. When the reference count reaches 0, the * connection is closed.</p> * * @see #addRef() */ public void subRef() { if (ref.decrementAndGet() == 0) { target.close(); } }
/** * Invoked from the transport thread, requested by the shutdown * method. */ private void handleShutdown() { if (req != null) { req.abort(); req = null; } if (target != null) { target.close(); target = null; } specs = new Entry[0]; }
/** * Convenience method for connecting to a peer, invoking a method * and disconnecting. * * @param spec the address to connect to * @param req the invocation request * @param timeout request timeout in seconds **/ public void invokeBatch(Spec spec, Request req, double timeout) { Target target = connectSync(spec); try { target.invokeSync(req, timeout); } finally { target.close(); } }
private void handleRegisterCallbackDone(Request req, String name, String spec, Target target){ String stored = services.get(name); if (stored != null) { // too late if ( ! stored.equals(spec)) { req.setError(ErrorCode.METHOD_FAILED, "service '" + name + "' registered with another spec"); } req.returnRequest(); target.close(); return; } target.setContext(name); target.addWatcher(monitor); services.put(name, spec); targets.put(name, target); req.returnRequest(); updated(); }
/** * Invoked from the transport thread, requested by the shutdown * method. **/ private void handleShutdown() { orb.removeMethod(m_list); orb.removeMethod(m_unreg); if (req != null) { req.abort(); req = null; } if (target != null) { target.close(); target = null; } }
private void rpc_unregister(Request req) { String name = req.parameters().get(0).asString(); String spec = req.parameters().get(1).asString(); String stored = services.get(name); if (stored != null) { if (stored.equals(spec)) { Target target = targets.remove(name); target.removeWatcher(monitor); services.remove(name); target.close(); updated(); } else { req.setError(ErrorCode.METHOD_FAILED, "service '" + name + "' registered with another spec"); } } }
@Override public void handleRequestDone(Request req) { if ( ! req.checkReturnTypes("S")) { registerReq.setError(ErrorCode.METHOD_FAILED, "error during register callback: " + req.errorMessage()); registerReq.returnRequest(); target.close(); return; } String[] names = req.returnValues().get(0).asStringArray(); boolean found = false; for (String n : names) { if (n.equals(name)) { found = true; } } if (!found) { registerReq.setError(ErrorCode.METHOD_FAILED, "register failed: served names does not contain name"); registerReq.returnRequest(); target.close(); return; } handleRegisterCallbackDone(registerReq, name, spec, target); } }
target.close(); if (supervisor!=null) supervisor.transport().shutdown().join();
target.close(); target = null;
req.returnValues().get(3).count())) target.close(); target = null;