use of org.apache.nifi.io.socket.SocketConfiguration in project nifi by apache.
the class Node method createCoordinatorProtocolSender.
@SuppressWarnings("unchecked")
private ClusterCoordinationProtocolSender createCoordinatorProtocolSender() {
final SocketConfiguration socketConfig = new SocketConfiguration();
socketConfig.setSocketTimeout(3000);
socketConfig.setReuseAddress(true);
final ProtocolContext<ProtocolMessage> protocolContext = new JaxbProtocolContext<>(JaxbProtocolUtils.JAXB_CONTEXT);
return new StandardClusterCoordinationProtocolSender(socketConfig, protocolContext, 1);
}
use of org.apache.nifi.io.socket.SocketConfiguration in project nifi by apache.
the class SocketConfigurationFactoryBean method getObject.
@Override
public SocketConfiguration getObject() throws Exception {
if (configuration == null) {
configuration = new SocketConfiguration();
final int timeout = (int) FormatUtils.getTimeDuration(properties.getClusterNodeReadTimeout(), TimeUnit.MILLISECONDS);
configuration.setSocketTimeout(timeout);
configuration.setReuseAddress(true);
if (Boolean.valueOf(properties.getProperty(NiFiProperties.CLUSTER_PROTOCOL_IS_SECURE))) {
configuration.setSSLContextFactory(new SSLContextFactory(properties));
}
}
return configuration;
}
use of org.apache.nifi.io.socket.SocketConfiguration in project nifi by apache.
the class Node method createNodeProtocolSender.
@SuppressWarnings("unchecked")
private NodeProtocolSender createNodeProtocolSender() {
final SocketConfiguration socketConfig = new SocketConfiguration();
socketConfig.setSocketTimeout(3000);
socketConfig.setReuseAddress(true);
final ProtocolContext<ProtocolMessage> protocolContext = new JaxbProtocolContext<>(JaxbProtocolUtils.JAXB_CONTEXT);
final NodeProtocolSender protocolSender = new LeaderElectionNodeProtocolSender(socketConfig, protocolContext, electionManager);
return protocolSender;
}
use of org.apache.nifi.io.socket.SocketConfiguration in project nifi by apache.
the class SocketProtocolListenerTest method setup.
@Before
public void setup() throws Exception {
final ProtocolContext protocolContext = new JaxbProtocolContext(JaxbProtocolUtils.JAXB_CONTEXT);
marshaller = protocolContext.createMarshaller();
unmarshaller = protocolContext.createUnmarshaller();
ServerSocketConfiguration configuration = new ServerSocketConfiguration();
configuration.setSocketTimeout(1000);
listener = new SocketProtocolListener(5, 0, configuration, protocolContext);
listener.start();
int port = listener.getPort();
SocketConfiguration config = new SocketConfiguration();
config.setReuseAddress(true);
config.setSocketTimeout(1000);
socket = SocketUtils.createSocket(new InetSocketAddress("localhost", port), config);
}
Aggregations