boolean setTubelineHead(Tube newHead) { if (newHead == head || newHead == adaptedHead) { return false; } head = newHead; tubes.add(head); adaptedHead = null; if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer(MessageFormat.format("Added '{0}' tube instance to the tubeline.", (newHead == null) ? null : newHead.getClass().getName())); } return true; }
boolean setTubelineHead(Tube newHead) { if (newHead == head || newHead == adaptedHead) { return false; } head = newHead; tubes.add(head); adaptedHead = null; if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer(MessageFormat.format("Added '{0}' tube instance to the tubeline.", (newHead == null) ? null : newHead.getClass().getName())); } return true; }
protected void report(String msg) { if (out == null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "No output set for web service annotation processor reporting."); } return; } out.println(msg); out.flush(); }
protected void report(String msg) { if (out == null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "No output set for web service annotation processor reporting."); } return; } out.println(msg); out.flush(); }
public static void clear() { state.set(State.EMPTY); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : Current HA state cleared"); } }
protected void report(String msg) { if (out == null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "No output set for web service annotation processor reporting."); } return; } out.println(msg); out.flush(); }
protected void report(String msg) { if (out == null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "No output set for web service annotation processor reporting."); } return; } out.println(msg); out.flush(); }
boolean setTubelineHead(Tube newHead) { if (newHead == head || newHead == adaptedHead) { return false; } head = newHead; tubes.add(head); adaptedHead = null; if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer(MessageFormat.format("Added '{0}' tube instance to the tubeline.", (newHead == null) ? null : newHead.getClass().getName())); } return true; }
private String encodeCid(String ns) { String cid = "example.jaxws.sun.com"; String name = UUID.randomUUID() + "@"; if (ns != null && (ns.length() > 0)) { try { URI uri = new URI(ns); cid = uri.toURL().getHost(); } catch (URISyntaxException e) { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, null, e); } return null; } catch (MalformedURLException e) { try { cid = URLEncoder.encode(ns, "UTF-8"); } catch (UnsupportedEncodingException e1) { throw new WebServiceException(e); } } } return name + cid; } }
public static State initFrom(final State newState) { final State oldState = state.get(); state.set(newState); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : Initialized from state - replaced old " + oldState.toString() + " with a new " + newState.toString()); } return oldState; }
private String encodeCid(String ns) { String cid = "example.jaxws.sun.com"; String name = UUID.randomUUID() + "@"; if (ns != null && (ns.length() > 0)) { try { URI uri = new URI(ns); cid = uri.toURL().getHost(); } catch (URISyntaxException e) { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, null, e); } return null; } catch (MalformedURLException e) { try { cid = URLEncoder.encode(ns, "UTF-8"); } catch (UnsupportedEncodingException e1) { throw new WebServiceException(e); } } } return name + cid; } }
private String encodeCid(String ns) { String cid = "example.jaxws.sun.com"; String name = UUID.randomUUID() + "@"; if (ns != null && (ns.length() > 0)) { try { URI uri = new URI(ns); cid = uri.toURL().getHost(); } catch (URISyntaxException e) { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, null, e); } return null; } catch (MalformedURLException e) { try { cid = URLEncoder.encode(ns, "UTF-8"); } catch (UnsupportedEncodingException e1) { throw new WebServiceException(e); } } } return name + cid; } }
public static void updateHaInfo(final HaInfo newValue) { final Packet packet = state.get().packet; state.set(new State(packet, newValue)); if (packet != null && packet.supports(Packet.HA_INFO)) { packet.put(Packet.HA_INFO, newValue); } if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : HaInfo value updated: " + asString(newValue)); } }
public static State initFrom(final Packet packet) { final State oldState = state.get(); HaInfo haInfo = null; if (packet != null && packet.supports(Packet.HA_INFO)) { haInfo = (HaInfo) packet.get(Packet.HA_INFO); } final State newState = new State(packet, haInfo); state.set(newState); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : Initialized from packet - replaced old " + oldState.toString() + " with a new " + newState.toString()); } return oldState; }
private URL loadFromServletContext(String resource) throws RuntimeException { Object context = null; try { final Class<?> contextClass = Class.forName("javax.servlet.ServletContext"); context = container.getSPI(contextClass); if (context != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(TubelineassemblyMessages.MASM_0012_LOADING_VIA_SERVLET_CONTEXT(resource, context)); } try { final Method method = context.getClass().getMethod("getResource", String.class); final Object result = method.invoke(context, "/WEB-INF/" + resource); return URL.class.cast(result); } catch (Exception e) { throw LOGGER.logSevereException(new RuntimeException(TubelineassemblyMessages.MASM_0013_ERROR_INVOKING_SERVLET_CONTEXT_METHOD("getResource()")), e); } } } catch (ClassNotFoundException e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(TubelineassemblyMessages.MASM_0014_UNABLE_TO_LOAD_CLASS("javax.servlet.ServletContext")); } } return null; } }
public static void udpateReplicaInstance(final String replicaInstance) { boolean updateNeeded = false; final State currentState = state.get(); if (currentState.haInfo == null) { throw new IllegalStateException("Unable to update replicaInstance. Current HaInfo in the local thread is null."); } if (replicaInstance == null) { updateNeeded = currentState.haInfo.getReplicaInstance() != null; } else { updateNeeded = !replicaInstance.equals(currentState.haInfo.getReplicaInstance()); } if (updateNeeded) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : Replica instance value changed to '" + replicaInstance + "'. Updating current HaInfo."); } final HaInfo old = currentState.haInfo; updateHaInfo(new HaInfo(old.getKey(), replicaInstance, old.isFailOver())); } else if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : New replica instance value '" + replicaInstance + "' same as current - no HaInfo update necessary"); } }
/** * This method contains main task loop. It should not be called directly from outside. */ public void run() { LOGGER.entering(); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer(String.format("Starting delayed execution of [ %s ]", task.getName())); } try { task.run(DelayedTaskManager.this); } catch (Exception ex) { LOGGER.warning(String.format("An exception occured during execution of [ %s ]", task.getName()), ex); } finally { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer(String.format("Delayed execution of [ %s ] finished", task.getName())); } LOGGER.exiting(); } } }
@Override public URL getResource(String resource) throws MalformedURLException { LOGGER.entering(resource); URL resourceUrl = null; try { if (parentLoader != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(TubelineassemblyMessages.MASM_0011_LOADING_RESOURCE(resource, parentLoader)); } resourceUrl = parentLoader.getResource(resource); } if (resourceUrl == null) { resourceUrl = loadViaClassLoaders("META-INF/" + resource); } if (resourceUrl == null && container != null) { // TODO: we should remove this code path, the config file should be loaded using ResourceLoader only resourceUrl = loadFromServletContext(resource); } return resourceUrl; } finally { LOGGER.exiting(resourceUrl); } }
@Override public URL getResource(String resource) throws MalformedURLException { LOGGER.entering(resource); URL resourceUrl = null; try { if (parentLoader != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(TubelineassemblyMessages.MASM_0011_LOADING_RESOURCE(resource, parentLoader)); } resourceUrl = parentLoader.getResource(resource); } if (resourceUrl == null) { resourceUrl = loadViaClassLoaders("META-INF/" + resource); } if (resourceUrl == null && container != null) { // TODO: we should remove this code path, the config file should be loaded using ResourceLoader only resourceUrl = loadFromServletContext(resource); } return resourceUrl; } finally { LOGGER.exiting(resourceUrl); } }
@Override public URL getResource(String resource) throws MalformedURLException { LOGGER.entering(resource); URL resourceUrl = null; try { if (parentLoader != null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(TubelineassemblyMessages.MASM_0011_LOADING_RESOURCE(resource, parentLoader)); } resourceUrl = parentLoader.getResource(resource); } if (resourceUrl == null) { resourceUrl = loadViaClassLoaders("META-INF/" + resource); } if (resourceUrl == null && container != null) { // TODO: we should remove this code path, the config file should be loaded using ResourceLoader only resourceUrl = loadFromServletContext(resource); } return resourceUrl; } finally { LOGGER.exiting(resourceUrl); } }