/** * Set socket options pulled from the network configuration. * * @throws SocketException */ private void setSocketOptions() throws SocketException { final NetworkConfiguration configuration = networkImpl.getConfiguration(); final Integer soLinger = configuration.getSoLinger(protocol, address, proxy, this); final boolean linger = -1 < soLinger ? true : false; logger.logDebug("{0} - linger:{1}", getId(), linger); logger.logDebug("{0} - soLinger:{1}", getId(), soLinger); final Integer soTimeout = configuration.getSoTimeout(protocol, address, proxy, this); logger.logDebug("{0} - soTimeout:{1}", getId(), soTimeout); final Boolean tcpNoDelay = configuration.getTcpNoDelay(protocol, address, proxy, this); logger.logDebug("{0} - tcpNoDelay:{1}", getId(), tcpNoDelay); socket.setSoLinger(linger, linger ? soLinger : -1); socket.setSoTimeout(soTimeout); socket.setTcpNoDelay(tcpNoDelay); }
public static void checkNetworkConfiguration(NetworkConfiguration config) { // Check optional fields if (config.getIpScope() != null) { checkIpScope(config.getIpScope()); } if (config.getParentNetwork() != null) { checkReferenceType(config.getParentNetwork()); } if (config.getNetworkFeatures() != null) { checkNetworkFeatures(config.getNetworkFeatures()); } if (config.getSyslogServerSettings() != null) { checkSyslogServerSettings(config.getSyslogServerSettings()); } if (config.getRouterInfo() != null) { checkRouterInfo(config.getRouterInfo()); } }
public void setPassThroughMode() throws MetricsConfigurationException { mNetworkConfiguration = new MetricsNetworkConfiguration( TransportType.OUTPUT_STREAM, mNetworkConfiguration.getNetworkTypes()); mCodecConfiguration = new CodecConfiguration(CodecType.STRING, "1.0"); mPipelineConfigurationMap.clear(); mPipelineConfigurationMap.put(Priority.NORMAL, sPassThroughNormalPriorityPipelineConfiguration); mPipelineConfigurationMap.put(Priority.HIGH, sPassThroughHighPriorityPipelineConfiguration); }
public MetricsConfiguration( NetworkConfiguration networkconfiguration, BatchQueueConfiguration batchqueueconfiguration, CodecConfiguration codecconfiguration, HttpConfiguration httpconfiguration, Map map) throws MetricsConfigurationException { if (networkconfiguration == null) { throw new MetricsConfigurationException("NetworkConfiguration is null"); } if (batchqueueconfiguration == null) { throw new MetricsConfigurationException("BatchQueueConfiguration is null"); } if (codecconfiguration == null) { throw new MetricsConfigurationException("CodecConfiguration is null"); } if (httpconfiguration == null) { throw new MetricsConfigurationException("HttpConfiguration is null"); } if (map == null || map.isEmpty()) { throw new MetricsConfigurationException("PipelineConfiguration map is null"); } mNetworkConfiguration = networkconfiguration; mBatchQueueConfiguration = batchqueueconfiguration; mCodecConfiguration = codecconfiguration; mHttpConfiguration = httpconfiguration; mPipelineConfigurationMap = map; networkconfiguration = mPipelineConfigurationMap.keySet().iterator(); do { if (!networkconfiguration.hasNext()) { break; } batchqueueconfiguration = (Priority) networkconfiguration.next(); if (((BatchPipelineConfiguration) mPipelineConfigurationMap.get(batchqueueconfiguration)) .getBatchQueueType() == null) { ((BatchPipelineConfiguration) mPipelineConfigurationMap.get(batchqueueconfiguration)) .setBatchQueueType(mBatchQueueConfiguration.getBatchQueueType()); ((BatchPipelineConfiguration) mPipelineConfigurationMap.get(batchqueueconfiguration)) .setDirectoryPrefix(mBatchQueueConfiguration.getDirectoryPrefix()); } } while (true); }
public void connet(String host) { client = new Client(); client.start(); config.register(client); networkMessageAdapter.init(client); if (sync) { queuedListener = new WaitingQueuedListener(new NetworkListener(config, networkMessageAdapter)); client.addListener(queuedListener); } else client.addListener( new Listener.ThreadedListener(new NetworkListener(config, networkMessageAdapter))); try { client.connect(5000, host, config.getServerTCPPort(), config.getServerUDPPort()); } catch (IOException e) { logger.log(Level.SEVERE, "Can not bind port", e); // e.printStackTrace(); } }
public MetricsConfiguration( NetworkConfiguration networkconfiguration, CodecConfiguration codecconfiguration, HttpConfiguration httpconfiguration, Map map) throws MetricsConfigurationException { if (networkconfiguration == null) { throw new MetricsConfigurationException("NetworkConfiguration is null"); } if (codecconfiguration == null) { throw new MetricsConfigurationException("CodecConfiguration is null"); } if (httpconfiguration == null) { throw new MetricsConfigurationException("HttpConfiguration is null"); } if (map == null || map.isEmpty()) { throw new MetricsConfigurationException("PipelineConfiguration map is null"); } mNetworkConfiguration = networkconfiguration; mCodecConfiguration = codecconfiguration; mHttpConfiguration = httpconfiguration; mPipelineConfigurationMap = map; networkconfiguration = (BatchPipelineConfiguration) mPipelineConfigurationMap.get(Priority.NORMAL); if (networkconfiguration != null) { mBatchQueueConfiguration = new BatchQueueConfiguration( networkconfiguration.getBatchQueueType(), networkconfiguration.getDirectoryPrefix()); return; } else { networkconfiguration = (BatchPipelineConfiguration) mPipelineConfigurationMap.values().iterator().next(); mBatchQueueConfiguration = new BatchQueueConfiguration( networkconfiguration.getBatchQueueType(), networkconfiguration.getDirectoryPrefix()); return; } }