/** * Return a new client that may be cached or not. Given properties are always use when not cached, and only used at creation time for * cached clients. * * @param name * if null, default client. Otherwise, helpful to retrieve cached clients later. * @param p * a set of properties. Implementation specific. Unknown properties are silently ignored. * @param cached * if false, the client will not be cached and subsequent calls with the same name will return different objects. */ public static JqmClient getClient(String name, Properties p, boolean cached) { Properties p2 = null; if (binder == null) { bind(); } if (p == null) { p2 = props; } else { p2 = new Properties(props); p2.putAll(p); } return binder.getClientFactory().getClient(name, p2, cached); }
/** * Remove the client of the given name from the static cache. Next time {@link #getClient(String, Properties, boolean)} is called, * initialization cost will have to be paid once again.<br> * Use <code>null</code> to reset the default client.<br> * This method is mostly useful for tests when databases are reset and therefore clients become invalid as they hold connections to * them.<br> * If the name does not exist, no exception is thrown. * * @param name * the client to reset, or <code>null</code> for the default client */ public static void resetClient(String name) { if (binder == null) { bind(); } binder.getClientFactory().resetClient(name); }