/** * Adds a new task for scheduled execution. * * @param task new task to be executed regularly at a defined rate * @param initialDelay the time to delay first execution (in milliseconds) * @param period the period between successive executions (in milliseconds) */ public ScheduledFuture<?> startTask(Runnable task, long initialDelay, long period) { final ScheduledFuture<?> taskHandle = getExecutorService().scheduleAtFixedRate(task, initialDelay, period, TimeUnit.MILLISECONDS); if (!scheduledTaskHandles.offer(taskHandle)) { // TODO L10N LOGGER.warning(String.format("Unable to store handle for task of class [ %s ]", task.getClass().getName())); } return taskHandle; }
private URI createEndpointComponentUri(@NotNull QName serviceName, @NotNull QName portName) { StringBuilder sb = new StringBuilder(serviceName.getNamespaceURI()).append("#wsdl11.port(").append(serviceName.getLocalPart()).append('/').append(portName.getLocalPart()).append(')'); try { return new URI(sb.toString()); } catch (URISyntaxException ex) { Logger.getLogger(TubelineAssemblyController.class).warning( TubelineassemblyMessages.MASM_0020_ERROR_CREATING_URI_FROM_GENERATED_STRING(sb.toString()), ex); return null; } } }
private URI createEndpointComponentUri(@NotNull QName serviceName, @NotNull QName portName) { StringBuilder sb = new StringBuilder(serviceName.getNamespaceURI()).append("#wsdl11.port(").append(serviceName.getLocalPart()).append('/').append(portName.getLocalPart()).append(')'); try { return new URI(sb.toString()); } catch (URISyntaxException ex) { Logger.getLogger(TubelineAssemblyController.class).warning( TubelineassemblyMessages.MASM_0020_ERROR_CREATING_URI_FROM_GENERATED_STRING(sb.toString()), ex); return null; } } }
public static byte[] toBytes(Message message, String encoding) throws XMLStreamException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (message != null) { XMLStreamWriter xsw = xmlOutputFactory.get().createXMLStreamWriter(baos, encoding); try { message.writeTo(xsw); } finally { try { xsw.close(); } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while closing XMLStreamWriter", ex); } } } return baos.toByteArray(); } finally { try { baos.close(); } catch (IOException ex) { LOGGER.warning("Unexpected exception occured while closing ByteArrayOutputStream", ex); } } }
private URI createEndpointComponentUri(@NotNull QName serviceName, @NotNull QName portName) { StringBuilder sb = new StringBuilder(serviceName.getNamespaceURI()).append("#wsdl11.port(").append(serviceName.getLocalPart()).append('/').append(portName.getLocalPart()).append(')'); try { return new URI(sb.toString()); } catch (URISyntaxException ex) { Logger.getLogger(TubelineAssemblyController.class).warning( TubelineassemblyMessages.MASM_0020_ERROR_CREATING_URI_FROM_GENERATED_STRING(sb.toString()), ex); return null; } } }
/** * Clients cannot be managed. * * @return False. */ public boolean isManagementEnabled() { final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME); if (management != null) { if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) { LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED()); } } return false; }
public static byte[] toBytes(Message message, String encoding) throws XMLStreamException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (message != null) { XMLStreamWriter xsw = xmlOutputFactory.get().createXMLStreamWriter(baos, encoding); try { message.writeTo(xsw); } finally { try { xsw.close(); } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while closing XMLStreamWriter", ex); } } } return baos.toByteArray(); } finally { try { baos.close(); } catch (IOException ex) { LOGGER.warning("Unexpected exception occured while closing ByteArrayOutputStream", ex); } } }
public static String messageDataToString(final byte[] data, final String encoding) { try { return toString(toMessage(new ByteArrayInputStream(data), encoding)); // closing ByteArrayInputStream has no effect, so ignoring the redundant call } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while converting message data to string", ex); return "[ Message Data Conversion Failed ]"; } }
/** * Clients cannot be managed. * * @return False. */ public boolean isManagementEnabled() { final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME); if (management != null) { if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) { LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED()); } } return false; }
/** * Clients cannot be managed. * * @return False. */ public boolean isManagementEnabled() { final String management = this.getAttributeValue(MANAGEMENT_ATTRIBUTE_QNAME); if (management != null) { if (management.trim().toLowerCase().equals("on") || Boolean.parseBoolean(management)) { LOGGER.warning(ManagementMessages.WSM_1006_CLIENT_MANAGEMENT_ENABLED()); } } return false; }
public static String messageDataToString(final byte[] data, final String encoding) { try { return toString(toMessage(new ByteArrayInputStream(data), encoding)); // closing ByteArrayInputStream has no effect, so ignoring the redundant call } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while converting message data to string", ex); return "[ Message Data Conversion Failed ]"; } }
public static String messageDataToString(final byte[] data, final String encoding) { try { return toString(toMessage(new ByteArrayInputStream(data), encoding)); // closing ByteArrayInputStream has no effect, so ignoring the redundant call } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while converting message data to string", ex); return "[ Message Data Conversion Failed ]"; } }
public static byte[] toBytes(Message message, String encoding) throws XMLStreamException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (message != null) { XMLStreamWriter xsw = xmlOutputFactory.get().createXMLStreamWriter(baos, encoding); try { message.writeTo(xsw); } finally { try { xsw.close(); } catch (XMLStreamException ex) { LOGGER.warning("Unexpected exception occured while closing XMLStreamWriter", ex); } } } return baos.toByteArray(); } finally { try { baos.close(); } catch (IOException ex) { LOGGER.warning("Unexpected exception occured while closing ByteArrayOutputStream", ex); } } }
private Level getLevelValue(String propertyName) { Level retVal = null; String stringValue = System.getProperty(propertyName); if (stringValue != null) { // if value is not null => property is set, we will try to override the default logging level LOGGER.fine(TubelineassemblyMessages.MASM_0018_MSG_LOGGING_SYSTEM_PROPERTY_SET_TO_VALUE(propertyName, stringValue)); try { retVal = Level.parse(stringValue); } catch (IllegalArgumentException ex) { LOGGER.warning(TubelineassemblyMessages.MASM_0019_MSG_LOGGING_SYSTEM_PROPERTY_ILLEGAL_VALUE(propertyName, stringValue), ex); } } return retVal; }
private Level getLevelValue(String propertyName) { Level retVal = null; String stringValue = System.getProperty(propertyName); if (stringValue != null) { // if value is not null => property is set, we will try to override the default logging level LOGGER.fine(TubelineassemblyMessages.MASM_0018_MSG_LOGGING_SYSTEM_PROPERTY_SET_TO_VALUE(propertyName, stringValue)); try { retVal = Level.parse(stringValue); } catch (IllegalArgumentException ex) { LOGGER.warning(TubelineassemblyMessages.MASM_0019_MSG_LOGGING_SYSTEM_PROPERTY_ILLEGAL_VALUE(propertyName, stringValue), ex); } } return retVal; }
private Level getLevelValue(String propertyName) { Level retVal = null; String stringValue = System.getProperty(propertyName); if (stringValue != null) { // if value is not null => property is set, we will try to override the default logging level LOGGER.fine(TubelineassemblyMessages.MASM_0018_MSG_LOGGING_SYSTEM_PROPERTY_SET_TO_VALUE(propertyName, stringValue)); try { retVal = Level.parse(stringValue); } catch (IllegalArgumentException ex) { LOGGER.warning(TubelineassemblyMessages.MASM_0019_MSG_LOGGING_SYSTEM_PROPERTY_ILLEGAL_VALUE(propertyName, stringValue), ex); } } return retVal; }
/** * 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(); } } }