@Override public String toString() { return (getClass().getSimpleName() + "[" + _serviceRef.address() + "," + _method.name() + "," + _id + "]"); } }
/** * Lookup a child service in the ServiceManager with a relative path. * <p> * The lookup is a convenience method based on the ServiceManager's lookup. * * @param path a relative path to the service. */ default ServiceRef service(String path) { if (!path.startsWith("/")) { throw new IllegalArgumentException(path + " must start with '/'"); } return services().service(address() + path); }
public void timeout(long now) { if (_expireTime < now) { ServiceExceptionTimeout exn = new ServiceExceptionTimeout(L.l("query timeout calling {0} in {1}", _method.name(), _serviceRef.address())); exn.fillInStackTrace(); fail(exn); } }
@OnInit public void onInit() throws Exception { String address = ServiceRef.current().address() + _id; _logger.log(Level.CONFIG, "onInit: id=" + _id + ", service address=" + address); _jdbcConfig = JdbcConfig.from(_config, address); _logger.log(Level.CONFIG, "onInit: config=" + _jdbcConfig); Properties props = new Properties(); if (_jdbcConfig.user() != null) { props.setProperty("user", _jdbcConfig.user()); if (_jdbcConfig.pass() != null) { props.setProperty("password", _jdbcConfig.pass()); } } Supplier<JdbcConnection> supplier = new ConnectionSupplier(_jdbcConfig.url(), props, _jdbcConfig.testQueryBefore(), _jdbcConfig.testQueryAfter()); ServiceBuilder builder = Services.current().newService(JdbcConnection.class, supplier); ServiceRef ref = builder.workers(_jdbcConfig.poolSize()).start(); _conn = ref.as(JdbcConnection.class); }