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; }
public static void clear() { state.set(State.EMPTY); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("[METRO-HA] " + Thread.currentThread().toString() + " : Current HA state cleared"); } }
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; }
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; }
public boolean register(@NotNull DelayedTask task, long delay, TimeUnit timeUnit) { if (isClosed()) { LOGGER.finer(String.format("Attempt to register a new task has failed. This '%s' instance has already been closed", this.getClass().getName())); return false; } assert task != null; getExecutorService().schedule(new Worker(task), delay, timeUnit); return true; }
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; }
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(); } } }
getLogger().finer("Container did not return SPI for ScheduledExecutorService - creating thread pool for " + getThreadPoolName()); ThreadFactory threadFactory = createThreadFactory(); if (threadFactory == null) { getLogger().finer("Using Container SPI for ScheduledExecutorService for " + getThreadPoolName()); useContainerSpi = true;
@NotNull public Tube createClient(@NotNull ClientTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling client-side tubeline for WS endpoint: " + jaxwsContext.getAddress().getURI().toString());
@NotNull public Tube createClient(@NotNull ClientTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling client-side tubeline for WS endpoint: " + jaxwsContext.getAddress().getURI().toString());
@NotNull public Tube createClient(@NotNull ClientTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling client-side tubeline for WS endpoint: " + jaxwsContext.getAddress().getURI().toString());
@NotNull public Tube createServer(@NotNull ServerTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling endpoint tubeline for WS endpoint: " + jaxwsContext.getEndpoint().getServiceName() + "::" + jaxwsContext.getEndpoint().getPortName());
@NotNull public Tube createServer(@NotNull ServerTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling endpoint tubeline for WS endpoint: " + jaxwsContext.getEndpoint().getServiceName() + "::" + jaxwsContext.getEndpoint().getPortName());
@NotNull public Tube createServer(@NotNull ServerTubeAssemblerContext jaxwsContext) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Assembling endpoint tubeline for WS endpoint: " + jaxwsContext.getEndpoint().getServiceName() + "::" + jaxwsContext.getEndpoint().getPortName());