private void logWarning() { if (logCount == 0 || System.currentTimeMillis() > nextLogTime ) { log.warning("Could not connect to the config proxy '" + spec.toString() + "'" + " - " + this + "@" + System.identityHashCode(this)); nextLogTime = System.currentTimeMillis() + Math.min(TimeUnit.DAYS.toMillis(1), TimeUnit.SECONDS.toMillis(30) * (++logCount)); log.info("Next log time = " + nextLogTime + ", current = " + System.currentTimeMillis()); } }
/** * <p>Constructs a new instance of this class.</p> * * @param spec The connection spec of this target. * @param orb The jrt supervisor to use when connecting to target. */ public RPCTarget(Spec spec, Supervisor orb) { this.name = spec.toString(); this.target = orb.connect(spec); }
/** * Returns the raw config needed to connect to the given slobrok. * * @param slobrok The slobrok whose connection spec to include. * @return The raw config string. */ public static String getSlobrokConfig(Slobrok slobrok) { return "raw:slobrok[1]\n" + "slobrok[0].connectionspec \"" + new Spec("localhost", slobrok.port()).toString() + "\"\n"; }
public String configId() { return "raw:slobrok[1]\n" + "slobrok[0].connectionspec \"" + new Spec("localhost", listener.port()).toString() + "\"\n"; }
/** * This method will return a target for the given address. If a target does not currently exist for the given * address, it will be created and added to the internal map. Each target is also reference counted so that an * active target is never expired. * * @param orb The supervisor to use to connect to the target. * @param address The address to resolve to a target. * @return A target for the given address. */ public RPCTarget getTarget(Supervisor orb, RPCServiceAddress address) { Spec spec = address.getConnectionSpec(); String key = spec.toString(); RPCTarget ret; synchronized (this) { Entry entry = targets.get(key); if (entry != null) { if (entry.target.getJRTTarget().isValid()) { entry.target.addRef(); entry.lastUse = timer.milliTime(); return entry.target; } entry.target.subRef(); targets.remove(key); } ret = new RPCTarget(spec, orb); targets.put(key, new Entry(ret, timer.milliTime())); } ret.addRef(); return ret; }
this.slobroks = slobroks; this.backOff = bop; mySpec = spec.toString(); updateTask = orb.transport().createTask(new Runnable() { public void run() { handleUpdate(); }