public class FIXServer extends Object implements com.epam.fixengine.manager.ConfiguredSessionListener
Modifier and Type | Field and Description |
---|---|
protected com.epam.fixengine.session.util.ConfigurationAdaptor |
configuration |
protected Map<Integer,com.epam.fixengine.FIXServer.ServerMeta> |
servers |
Constructor and Description |
---|
FIXServer() |
FIXServer(com.epam.fixengine.configuration.Configuration conf)
Creates the fix server.
|
FIXServer(com.epam.fixengine.configuration.Configuration conf,
int... ports) |
FIXServer(int... ports) |
Modifier and Type | Method and Description |
---|---|
protected Server |
addServer(com.epam.fixengine.session.util.ConfigurationAdaptor config,
Integer port,
Server server,
ConnectionHandler handler) |
void |
addServerStatusListener(FIXServerStatusListener statusListener) |
protected void |
clearServers() |
boolean |
closePort(int portNum)
Closes port for listening of incoming FIX sessions on the given port.
|
protected Server |
createServer(com.epam.fixengine.session.util.ConfigurationAdaptor config,
int port,
boolean autoClose) |
protected Server |
deleteServer(Integer port) |
protected SessionAcceptorStrategyHandler |
getAcceptorStrategy(com.epam.fixengine.session.util.ConfigurationAdaptor configuration,
com.epam.fixengine.manager.ConfiguredSessionRegister configuredSessionRegister) |
String |
getConfigPath()
Path to config file
|
protected ServerSocketFactory |
getConfiguredServerSocketFactory(com.epam.fixengine.configuration.Configuration configuration) |
String |
getNic() |
Set<Integer> |
getOpenPorts()
Provides with port numbers which added and actually started in this FIX Server.
|
int[] |
getPorts()
Listening ports
|
List<SessionParameters> |
getRegisterAcceptorSession() |
protected Server |
getServer(com.epam.fixengine.session.util.ConfigurationAdaptor config,
int port,
boolean autoClose) |
protected SessionTransportFactory |
getTransportFactory(com.epam.fixengine.configuration.Configuration configuration) |
protected boolean |
handleAutoClose(Integer portNum,
Server server) |
boolean |
isStarted() |
void |
onAddSession(SessionParameters params) |
void |
onRemoveSession(SessionParameters params) |
boolean |
openPort(com.epam.fixengine.configuration.Configuration config,
int portNum) |
boolean |
openPort(com.epam.fixengine.configuration.Configuration config,
int portNum,
boolean autoClose) |
boolean |
openPort(int portNum)
Opens port for listening of incoming FIX sessions on the given port (immediately if FIXServer is already started, or after its start).
|
boolean |
openPort(int portNum,
boolean autoClose)
Opens port for listening of incoming FIX sessions on the given port (immediately if FIXServer is already started, or after its start).
|
void |
registerAcceptorSession(SessionParameters sessionParameters)
Register the session parameters of acceptor.
|
protected void |
registerConfiguredSessions() |
void |
removeServerStatusListener(FIXServerStatusListener statusListener) |
void |
setConfigPath(String configPath)
Set path to config file
|
void |
setConnectionValidator(ConnectionValidator connectionValidator) |
void |
setIncomingConnectionExecutor(ExecutorService executorService)
Set custom executor service.
|
void |
setListener(FIXServerListener listener)
Sets listener.
|
void |
setLoginWaitTimeout(int loginWaitTimeout)
Sets login timeout.
|
void |
setNic(String nic) |
void |
setPort(int port)
Sets port to listen on.
|
void |
setPorts(com.epam.fixengine.session.util.ConfigurationAdaptor config,
int... ports) |
void |
setPorts(int... ports)
Sets ports to listen on.
|
void |
setServer(Server server)
Replaces default TCPServer implementation with custom Server implementation.
|
boolean |
start()
Actually starts the servers.
|
void |
stop()
Stops the server.
|
protected boolean |
stopAndDeleteServer(int portNum) |
void |
unregisterAcceptorSession(SessionParameters sessionParameters)
Remove registered acceptor session.
|
protected void |
validateBeforeRegistration(SessionParameters sessionParameters) |
protected final com.epam.fixengine.session.util.ConfigurationAdaptor configuration
public FIXServer()
public FIXServer(int... ports)
public FIXServer(com.epam.fixengine.configuration.Configuration conf)
public FIXServer(com.epam.fixengine.configuration.Configuration conf, int... ports)
protected SessionTransportFactory getTransportFactory(com.epam.fixengine.configuration.Configuration configuration)
protected SessionAcceptorStrategyHandler getAcceptorStrategy(com.epam.fixengine.session.util.ConfigurationAdaptor configuration, com.epam.fixengine.manager.ConfiguredSessionRegister configuredSessionRegister)
public void setServer(@NotNull Server server)
server
- implementation specified by userServer
public void setListener(FIXServerListener listener)
listener
- - user specified listenerpublic void setConnectionValidator(ConnectionValidator connectionValidator)
public void setLoginWaitTimeout(int loginWaitTimeout)
loginWaitTimeout
- the login timeout in milspublic void setPorts(int... ports)
ports
- ports to listen onpublic void setPorts(com.epam.fixengine.session.util.ConfigurationAdaptor config, int... ports)
protected Server addServer(com.epam.fixengine.session.util.ConfigurationAdaptor config, Integer port, Server server, ConnectionHandler handler)
protected void clearServers()
protected Server createServer(com.epam.fixengine.session.util.ConfigurationAdaptor config, int port, boolean autoClose)
protected Server getServer(com.epam.fixengine.session.util.ConfigurationAdaptor config, int port, boolean autoClose)
public int[] getPorts()
public void setPort(int port)
port
- port to listen onpublic void setNic(String nic)
public String getNic()
public boolean start() throws IOException
IOException
- if unable to start the server at least on one port. In this case the first received
exception will be thrown.protected void registerConfiguredSessions()
public void stop() throws IOException
IOException
- if stop was unsuccessfulpublic Set<Integer> getOpenPorts()
public boolean openPort(int portNum) throws IOException
portNum
- the socket port numberIOException
- if was failed to openpublic boolean openPort(com.epam.fixengine.configuration.Configuration config, int portNum) throws IOException
IOException
public boolean openPort(int portNum, boolean autoClose) throws IOException
portNum
- the socket port numberautoClose
- flag to switch on/off auto close of port listening on removing from registry of last session with the given portIOException
- if was failed to openpublic boolean openPort(com.epam.fixengine.configuration.Configuration config, int portNum, boolean autoClose) throws IOException
IOException
public boolean closePort(int portNum)
portNum
- the socket port numberprotected boolean stopAndDeleteServer(int portNum)
public void registerAcceptorSession(SessionParameters sessionParameters)
sessionParameters
- the sessionParameterspublic void unregisterAcceptorSession(SessionParameters sessionParameters)
sessionParameters
- public List<SessionParameters> getRegisterAcceptorSession()
public String getConfigPath()
public void setConfigPath(String configPath)
configPath
- path to config filepublic void setIncomingConnectionExecutor(ExecutorService executorService)
executorService
- the executor will be used for working with incoming connections.protected ServerSocketFactory getConfiguredServerSocketFactory(@NotNull com.epam.fixengine.configuration.Configuration configuration)
public boolean isStarted()
public void addServerStatusListener(FIXServerStatusListener statusListener)
public void removeServerStatusListener(FIXServerStatusListener statusListener)
public void onAddSession(SessionParameters params)
onAddSession
in interface com.epam.fixengine.manager.ConfiguredSessionListener
public void onRemoveSession(SessionParameters params)
onRemoveSession
in interface com.epam.fixengine.manager.ConfiguredSessionListener
protected void validateBeforeRegistration(SessionParameters sessionParameters)
Copyright © 2000–2022 EPAM Systems. All rights reserved.